Deploy a Vite + React app to production
Vite + React is the default output of Lovable and Bolt and the most common 'just a frontend' stack agents produce. Launchmatic serves the static build — and unlike a static host, the API server your agent inevitably adds later deploys the same way.
How detection works
A vite dependency in package.json. Nixpacks runs npm run build and serves the dist/ output (via your preview/start script or a static server).
Build configuration & gotchas
Serve command
vite preview works but is not hardened for production. Prefer a tiny static server: npm i serve and set "start": "serve -s dist -l $PORT" — the -s flag gives you SPA fallback routing.
SPA routing
React Router needs all paths to fall back to index.html. serve -s handles it; without it, deep links 404 on refresh.
API base URL
Vite env vars are baked at build time (import.meta.env.VITE_*). Set VITE_API_URL before deploying, not in the running container.
Environment variables
VITE_API_URLBuild-time — set it before `lm deploy`.PORTInjected by Launchmatic; pass it to your serve command.package.json scripts for a production Vite deploy:
{
"scripts": {
"build": "vite build",
"start": "serve -s dist -l $PORT"
},
"dependencies": { "serve": "^14" }
}FAQ
My Lovable/Bolt app is Vite + Supabase — what changes?+
Nothing structural. Keep the Supabase env vars (they're VITE_-prefixed and baked at build time) or migrate to a Launchmatic Postgres later. The hosting swap is independent of the data layer.
Ready to deploy?
Free to start. No credit card. Auto-SSL on custom domains, managed Postgres, and per-branch preview deploys included.
This guide is part of our complete vibe coding hosting guide — how to take any AI-built app to production.