#Milestine Frontend
React + Vite frontend
This frontend is productionized with:
Dockerfile: multi-stage build (Node 20 builder + Nginx runtime)nginx.conf: SPA-safe routing and static asset caching.dockerignore: reduced build context for faster, cleaner image builds.env: local frontend environment file
The final container serves static files from Nginx on port 80.
- Docker Desktop (Windows/macOS) or Docker Engine with Compose plugin (Linux)
- Host port
3000available
The project uses .env in this folder for local development values.
Common variables:
VITE_BACKEND_URL: backend base URL compiled into the production frontend buildVITE_API_BASE_URL: optional alias used in parts of the codebase
Example .env:
VITE_BACKEND_URL=http://localhost:9000
VITE_API_BASE_URL=http://localhost:9000Note: For Docker production builds, pass backend URL using build args:
docker build -t milestone-frontend --build-arg VITE_BACKEND_URL=http://localhost:9000 .Build image:
docker build -t milestone-frontend --build-arg VITE_BACKEND_URL=http://localhost:9000 .Run container:
docker run --rm -p 3000:80 milestone-frontendOpen in browser:
http://localhost:3000
- React Router support: unknown routes fallback to
/index.html - Aggressive cache headers for
/assets/* - Non-existing assets under
/assets/*return404
The Docker context excludes:
- dependency/build folders (
node_modules,dist,coverage) - VCS/editor files (
.git,.vscode,.idea) - local environment files (
.env,.env.*) - docs and OS artifacts
This keeps image builds smaller and avoids leaking local environment values into Docker build context.
From the backend workspace:
cd ../m-backend
docker compose up -d --buildExpected services:
- MongoDB:
27017 - Backend API:
9000 - Frontend:
3000
Rebuild frontend with the correct backend URL:
docker build -t milestone-frontend --build-arg VITE_BACKEND_URL=http://localhost:9000 .Ensure the container uses the included nginx.conf with SPA fallback:
try_files $uri $uri/ /index.html;