Skip to content

Local Development — Cloud Frontend

Terminal window
cd Frontend
cp .env.example .env
npm install

All variables are documented in Frontend/.env.example.

VariableDefaultNotes
VITE_API_URLhttp://localhost:8000Cloud Backend API origin — no trailing slash, no /api/v1 path
VITE_WS_URLws://localhost:8000/api/wsWebSocket base URL
VITE_ADMIN_PANEL_ENABLEDoffSet to true to show admin routes
VITE_PLATFORM_ADMIN_EMAIL_DOMAINmonozu.ioEmail domain for admin access
VITE_CLARITY_PROJECT_IDoffMicrosoft Clarity (leave unset locally)
Terminal window
npm run dev
# SPA available at http://localhost:3000

The Vite dev server proxies API requests to the backend based on VITE_API_URL. No manual proxy config needed — the Axios client in lib/config/api.ts uses VITE_API_URL as the base URL.

Terminal window
npm run build
# Output in dist/
npm run preview # Preview production build locally
Terminal window
npm run lint

When the SPA runs at http://localhost:3000 and the API at http://localhost:8000, they are on different ports but the same hostname (localhost). For cookie purposes, this is typically treated as same-site.

If you run into issues with the refresh cookie not being sent:

  1. Keep REFRESH_COOKIE_SAMESITE=strict (default) on the backend
  2. Ensure ALLOW_ORIGINS=http://localhost:3000,http://127.0.0.1:3000 is set on the backend
  3. Do not set VITE_WS_URL to use a different host

The Frontend Dockerfile builds the SPA and serves it with nginx on port 8080:

Terminal window
docker build -t monozu-frontend .
docker run -p 8080:8080 \
--build-arg VITE_API_URL=https://api.cloud.monozu.io \
monozu-frontend

Note: Vite env vars are baked into the build at npm run build time. Pass them as --build-arg in Docker, not as runtime environment variables.

Terminal window
npx tsc --noEmit # Type check without building

Type errors in one module won’t prevent other modules from running during dev, but all types must pass for the production build.