Skip to content

React deployment

Build and run the React SPA for Docker and production.

Related: Setup, Deployment overview, Production setup.

Production build

cd react-frontend
npm run build

This runs TypeScript project references (tsc -b) then Vite. Artifacts land in the configured dist/ output. Preview locally:

npm run preview

Set production env via .env.production (from .env.example) so VITE_API_BASE_URL points at the live API.

Docker layout

Modular Compose files:

Scope Files
Root stack docker-compose.dev.yml, docker-compose.test.yml, docker-compose.prod-test.yml (repo root)
Frontend-only react-frontend/docker-compose.dev.yml, docker-compose.test.yml, docker-compose.prod.yml

Frontend images use Dockerfile / Dockerfile.prod and serve static assets with Nginx (nginx.conf).

Frontend only

cd react-frontend
docker compose -f docker-compose.dev.yml up -d
# or the prod compose file for a production-like image

Full stack

From the repository root, use the root Compose files documented under Deployment.

Nginx SPA notes

Checklist before release

  • [ ] npm run build succeeds
  • [ ] VITE_API_BASE_URL targets the correct API
  • [ ] CORS allows the deployed frontend origin
  • [ ] Container health / static asset paths verified
  • [ ] Smoke-test login + token refresh against the deployed API