React, Vue and Vite
How to publish a static React, Vue or Vite site — on “Static” hosting or from Git with an automatic build.
A React, Vue or Vite build is a folder of static files. There are two ways to publish it.
| Way | How you update | Good for |
|---|---|---|
| “Static” hosting | Build locally and upload the files | Landing pages, business cards, rare updates |
| App from Git | Push to the repository, the platform builds | A project in active development, auto-deploy |
Way 1: “Static” hosting
- “New resource” → “Hosting” → the “Static” template.
- Build the project locally:
npm run build
- Open the “Files” tab and upload the contents of the
dist/folder (build/for create-react-app) to the root. You can upload the whole folder or an archive — the archive is unpacked right there. - Make sure
index.htmlis in the root, not inside a nesteddist/folder.
The server (nginx) serves the files immediately, no restart needed. To update, upload the new build over the old one.
The server serves files as they are: opening a client route like /about directly looks for a file named about. If the project uses react-router or vue-router in history mode, way 2 is more convenient.
Way 2: app from Git
- “New resource” → “App”, the repository link.
- The first deploy starts by itself.
The platform recognizes a static frontend when package.json:
- has a
buildscript; - has no
startscript; - lists
vite,react-scriptsor@vue/cli-serviceamong its dependencies.
It then runs npm ci and npm run build and serves the dist/ folder (build/ for react-scripts) through Caddy. Unknown paths get index.html, so react-router and vue-router routes also open from a direct link.
Auto-deploy on push, rollback and the build log are in the “Deploy” tab, as for any app: see Node.js.
Build-time variables
The API address and other public settings go in the “Variables” tab. Variables with these prefixes are passed into the build of an auto-detected Node.js project:
VITE_ NEXT_PUBLIC_ REACT_APP_ VUE_APP_ PUBLIC_
VITE_API_URL=https://api.example.com
fetch(`${import.meta.env.VITE_API_URL}/api/items`);
- Values may contain only Latin letters, digits and URL characters: no quotes, spaces,
$or backslashes. - Values are baked into the build, so after changing them you need a new deploy.
- Everything in the build is visible to any visitor in the browser. Do not put secret keys here.
A different build folder
If the build goes somewhere other than dist/ or build/ (for example out/), add your own Dockerfile to the repository:
FROM node:22-alpine AS build
WORKDIR /app
COPY . .
RUN npm ci && npm run build
FROM caddy:2-alpine
COPY Caddyfile /etc/caddy/Caddyfile
COPY --from=build /app/out /usr/share/caddy
EXPOSE 80
And a Caddyfile next to it:
:80 {
root * /usr/share/caddy
try_files {path} /index.html
file_server
}
With your own Dockerfile, variables from the “Variables” tab are not passed into the build automatically — pass them via ARG or put them in the repository's .env.