Deployka / Vite / React hosting

Hosting for Vite and React apps

Built a Vite / React / Vue landing page or SPA? Provide a ZIP or GitHub repo with package.json and scripts.build. Deployka builds it and serves the static output over HTTPS; no dev or preview server is needed.

What this page covers

  • vite build → dist
  • VITE_* variables
  • SPA / React Router fallback
  • static hosting
  • Node Micro

How to deploy

  1. Upload a ZIP or point to GitHub with vite.config and package.json.
  2. Add VITE_* / public ENV if needed.
  3. Deployka runs the build script and serves the static output over HTTPS.

React Router: fallback for nested URLs

Deployka serves the default Vite build with Nginx and does not enable an SPA fallback. Add Dockerfile and nginx.conf to your project root for this setup. The Dockerfile assumes npm with package-lock.json and Vite's default dist directory; adjust the install command or output path for another package manager or outDir. A supplied Dockerfile takes precedence over Vite auto-detection.

# Dockerfile (npm + package-lock.json)
FROM node:20-slim AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build

FROM nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80

# nginx.conf
server {
  listen 80;
  root /usr/share/nginx/html;
  location / {
    try_files $uri $uri/ /index.html;
  }
}

ENV you need

  • PORT — automatic.
  • VITE_* — baked in at build time; set them before deploy.
  • Do not put backend secrets here — public client values only.

Package managers and stack

  • npm
  • pnpm
  • yarn

Common failures

  • Blank page after deploy — check base in vite.config and JavaScript loading errors in the browser.
  • A direct visit to a nested React Router route can return 404: the default static build does not route unknown paths to index.html. Add an SPA fallback with your own Dockerfile — example below.
  • VITE_* missing — these must be present at build time, not only at runtime.
  • Build fails on TypeScript / ESLint — fix locally or relax strict checks in build scripts.

Pricing

For Vite / React / a small API, Node Micro is usually enough — $3.29/mo (1 vCPU, 512 MB RAM).

Useful links

Code ready. Deployka runs it.

See also