Skip to main content
Betadocs
DocsStatusSupportPricing
  • Introduction
    • Introduction to Webgune
    • How Webgune works
    • Creating an account
    • Creating your first project
    • Exploring the dashboard
  • Deployment

    • Deploying from GitHub
    • Deploying a Docker image
    • How builds work
    • Deployments and rollback
    • Environment variables
    • Custom start command
    • Health check
    • Database migrations

    Web apps

    • Web applications
      • Supported frameworks
      • Next.js
      • React / Vite
      • Node.js
      • Python
      • PHP
      • Go

    Bots & workers

    • Discord bots
    • Workers

    Docker

    • Docker
      • Writing a Dockerfile
      • Public Docker images

    Databases

    • Databases
      • PostgreSQL
      • MySQL
      • MariaDB
      • MongoDB
      • Redis

    Observability

    • Logs and monitoring
    • Web terminal

    Scaling

    • Availability and scaling
    • Persistent volumes
    • Backups and restore
    • Sleep mode

    Platform

    • One microVM per service
    • Network and isolation
    • Platform security
    • Deploying a template
      • Template catalog
    • Free subdomains
    • Custom domains
    • Buying a domain
    • Hosting DNS for a domain bought elsewhere
    • Managing your DNS records
    • SSL certificates
    • Redirects
    • Shared projects
      • Roles and permissions
    • Real-time collaboration
    • Continuous deployment
      • The kx712.yml file
    • VS Code extension
    • Plans and pricing
    • Payments and invoices
    • Account or per-project subscription
    • API reference
    • API keys
    • Webgune CLI
    • MCP server
    • JavaScript / TypeScript SDK
    • Support tickets
    • Status page
    • AI assistant
    • FAQ
    • Limits and resources
    • Account security
    • Best practices
    • Troubleshooting

Services / Web applications

React / Vite

Open as Markdown

A React, Vue or Svelte application built with Vite produces HTML, CSS and JavaScript files. There is no application server to run: you just serve the dist folder. Webgune offers two ways to do it, depending on the nature chosen for the service.

Choosing the service nature

Static site (recommended)Application
ServerNginx 1.28serve package on Node.js
Unknown address (/account/profile)Returns index.html404 error
/about serves about.htmlYesNo
Hidden files (.env, .git)Never servedDepends on serve behavior
Node.js in the imageNoYes

A single-page application that handles its routes in the browser (React Router, Vue Router, TanStack Router) must use the Static site nature. Otherwise, reloading the page on any address other than / returns a 404 error.

The nature is chosen at creation, in Configure service, or later in the service settings. The change takes effect at the next build.

What the build runs

Static site nature

  1. Frozen installation of dependencies, from the committed lock file.
  2. npm run build (your script, usually vite build).
  3. Copy of the first folder that contains an index.html among dist, build, out, _site, .output/public, public, www.
  4. Nginx image that serves this folder on the service's port.

Dependencies, sources and Node.js are not in the final image.

Application nature

Auto build recognizes Vite through vite.config.js, vite.config.ts or vite.config.mjs. It runs npm run build, then starts serve dist -p $PORT. The serve package is installed in the image at build time.

Create React App (react-scripts), Vue CLI and Preact CLI are served with a fallback to index.html, even in the Application nature. Angular too. The full list is on Supported frameworks.

The lock file

The build installs exactly what package-lock.json, bun.lock, pnpm-lock.yaml or yarn.lock describes. Without this file, or if it no longer matches package.json, the build fails. After any dependency change, run the install locally and commit the file (How builds work).

Environment variables

Vite only sends the browser the variables prefixed with VITE_:

VITE_API_URL=https://api.example.com
VITE_APP_NAME=MyApp
const apiUrl = import.meta.env.VITE_API_URL;
  • These values are written into the JavaScript at build time. Changing one requires a new build, not a simple restart.
  • Anything prefixed with VITE_ is readable by any visitor in the site's code. Never put a secret key there.
  • If the Build scope in the Variables panel is filled in, the build receives only that: your VITE_* variables must be in it (Environment variables).

A Create React App application uses the REACT_APP_ prefix, with the same rules.

Calling your API

The site runs in the visitor's browser, not on Webgune's servers. It must therefore call your API at its public address (https://api.example.com), never at an address internal to the project.

If the site and the API have different domains, the API must allow the site's origin (CORS headers). With Express and the cors package:

import cors from "cors";

app.use(cors({ origin: "https://www.example.com" }));

Monorepo subfolder

The build analyzes the repository root. If the Vite application is in apps/web, add a build script at the root that builds it, for example npm run build --workspace apps/web, and have the output produced in a folder from the list above. Otherwise, use a Dockerfile.

Common errors

SymptomCauseWhat to do
404 error when reloading a pageApplication nature with a browser-side routerSwitch to the Static site nature
"No index.html found"The build does not produce a known folderCheck build.outDir in vite.config
A variable is undefinedMissing VITE_ prefix, or variable absent from the Build scopeAdd the prefix, then redeploy
Blank page, JS files returning 404base in vite.config does not match the site's addressLeave base: "/" for a site served at the root
The install rejects the lock fileFile out of date with package.jsonRegenerate it locally and commit it

Updated on November 20, 2026

Next.jsPreviousNode.jsNext

On this page

Choosing the service natureWhat the build runsStatic site natureApplication natureThe lock fileEnvironment variablesCalling your APIMonorepo subfolderCommon errors
© 2026 WebguneBack to the site