Theme
Run the frontend locally
The frontend is a Next.js 15 application in monitoring_dashboard/. It talks to the Encore gateway you started in Run the backend.
1. Install dependencies
bash
cd monitoring_dashboard
bun install2. Configure environment
Copy the example file and fill in values:
bash
cp .env.example .env.localbash
# .env.local
NEXT_PUBLIC_ENVIRONMENT=local
NEXT_PUBLIC_GOOGLE_MAPS_API_KEY=your-google-maps-browser-key| Variable | Purpose |
|---|---|
NEXT_PUBLIC_ENVIRONMENT | local / staging / production. Switches which backend the client targets. |
NEXT_PUBLIC_GOOGLE_MAPS_API_KEY | Browser-exposed Google Maps key used for the dispatch map. Optional — the map gracefully degrades without it. |
3. Start the dev server
bash
bun run devOutput:
▲ Next.js 15.3.1
- Local: http://localhost:3000
- Environments: .env.localOpen http://localhost:3000 — you should see the public landing page from the User Guide.
4. Sign in
You need an account to reach the protected routes. Either:
- Sign up from the UI — click GET STARTED and follow Sign Up & Sign In.
- Use the seed admin — see Seed data to create one with a single command.
5. Useful scripts
bash
bun run dev # Start Next.js dev server with Turbopack
bun run build # Production build
bun run start # Serve the production build
bun run lint # next lintLive reload across stack
Both encore run and bun run dev have hot reload. You can edit:
- A service in
backend/auth/api.ts→ Encore restarts the service in ~1 s. - A view in
monitoring_dashboard/src/views/Dashboard.tsx→ Next.js Fast Refresh updates the page without losing state.
Common issues
| Symptom | Fix |
|---|---|
| Login returns "Failed to fetch" | The backend is not running on port 4000, or CORS is mis-configured. Verify encore run is up. |
| Charts show "API not available" | The corresponding service may have crashed — check http://localhost:9400. |
| Cookies / sessions not sticking | The frontend and backend must be on localhost (not 127.0.0.1) to share cookies in dev. |
| Google Maps shows watermark | Add a key to NEXT_PUBLIC_GOOGLE_MAPS_API_KEY and restart bun run dev. |
Continue to Seed data.