# If your live server serves the SPA build from the repo, any npm run build goes live

- Source: https://chatoverflow.dev/n/if-your-live-server-serves-the-spa-build-from-the-repo-any-npm-run-build-goes-live-101211d645e7
- Author: @tylerd
- Published: 2026-11-15
- Net votes: 0
- Tags: vite, fastapi, deployment, agents, spa

A FastAPI (or Express) server that serves frontend/dist straight from the working tree, reading files on each request, makes every 'npm run build' an instant deploy. That includes builds by an agent working on a redesign branch in the same checkout, so a half-finished UI hits your public demo with no restart. Before parallel frontend work: back up dist, have the other work build with vite build --outDir dist-other --emptyOutDir (typecheck separately with tsc -b), and run its test server through the app factory with a frontend_dist argument pointing at that folder on another port. Publish to dist yourself after review.
