Road Guard Safety
Detech Dispatch Repair Verify
The problem Road Guard Safety solves
RoadGuard is a smart road-damage detection and rapid-response system that uses cameras, IMU sensors, GPS and Edge AI to automatically detect potholes and road defects while municipal vehicles travel on their normal routes. The system verifies the defect using sensor fusion, identifies its exact location, assigns its severity and priority, and sends the information to a cloud-based municipal dashboard. Authorities can then dispatch repair teams and later verify the repair through another road scan, creating a complete closed-loop process from detection to resolution.
Challenges we ran into
RoadGuard
An AI-assisted municipal road-damage detection and repair-workflow dashboard.
- Frontend: React 19 + Vite, in the repo root.
- Backend: Node.js + Express + Socket.IO, in
server/. Real REST API, JSON-file persistence, file uploads for report photos, JWT auth, and real-time updates over WebSockets.
The frontend used to run entirely on hardcoded mock data. It now talks to the real backend below: reports, fleet status, work orders, notifications, activity feed, and settings are all persisted server-side and pushed live to every connected browser tab.
Quick start
You need two things running at once: the API server (port 4000) and the Vite dev server (port 5173). The Vite dev server proxies /api, /uploads, and /socket.io to the backend, so the frontend never needs to know a different origin.
# 1. Install both sets of dependencies
npm install
npm --prefix server install
# 2. Run both servers together
npm run dev:full
Then open http://localhost:5173.
If you'd rather run them in separate terminals:
npm run server # backend on http://localhost:4000
npm run dev # frontend on http://localhost:5173
The backend auto-creates its database (server/data/db.json) on first run, seeded with the same sample reports/fleet/notifications the mock version shipped with. To wipe it back to that seed state at any time:
npm --prefix server run seed:reset
Seeded login
The backend seeds one admin user for the JWT-protected /api/auth endpoints (not currently wired into the UI, but ready to use — see below):
username: admin
password: roadguard123
Override these via server/.env (copy from server/.env.example) before first run if you want different credentials.
What's actually real now
| Feature | Before | Now |
|---|---|---|
| Reports | Hardcoded array, reset on refresh | Persisted to disk, survives restarts |
| Report photo upload | Filename shown, never sent anywhere | Actually uploaded, stored, and served from server/uploads/ |
| AI severity/confidence score | Random number generated in the browser | Generated server-side from a damage-type → severity table, consistent for every client |
| Status advancement, fleet cycling, work-order stages | Local useReducer, per-tab only | Persisted server-side, broadcast to all open tabs instantly via Socket.IO |
| Notifications / activity feed | Mock array | Real, generated by backend events (new critical report, status change, etc.) |
| Settings | "Saved" toast with no actual persistence | Persisted to disk |
| Multi-user / multi-tab | Not possible — no shared state | Two browser tabs stay in sync live; open the dashboard in two windows and submit a report in one to see it appear in the other |
Backend API reference
Base URL: http://localhost:4000/api (or just /api through the Vite proxy).
| Method | Path | Description |
|---|---|---|
POST | /auth/login | { username, password } → { token, user } |
GET | /auth/me | Requires Authorization: Bearer <token> |
GET | /reports?search=&severity=&status= | List/filter reports |
GET | /reports/:id | Single report |
POST | /reports | Multipart form: location, damage, description, photo (file) |
PATCH | /reports/:id/advance | Moves status forward one stage (open → assigned → repair → resolved) |
DELETE | /reports/:id | Remove a report |
GET | /fleet | List fleet vehicles |
PATCH | /fleet/:id/status | { status? } — omit body to cycle to the next status |
GET | /workflow | List work-order pipeline stages |
POST | /workflow/advance | Advances the active stage to done, activates the next |
GET | /notifications | List notifications + unread count |
POST | /notifications/mark-all-read | Marks all as read |
GET | /activity?limit= | Recent activity feed |
GET | /settings | Current dashboard settings |
PUT | /settings | { refresh?, mapLayer?, criticalAlerts? } |
GET | /stats | Live counts: critical, moderate, total, resolved, open work orders |
GET | /stats/analytics | Resolution rate (real) + illustrative sensor metrics (see note below) |
Uploaded photos are served statically from /uploads/<filename>.
Real-time events (Socket.IO)
The backend emits these to every connected client whenever the underlying data changes — the frontend listens for all of them in src/state/StoreContext.jsx:
report:created, report:updated, report:deleted, activity:created, notification:created, notifications:markedAllRead, fleet:updated, workflow:updated, settings:updated.
Honest limitations
This is a functional backend for the dashboard's workflow (reports, fleet, work orders, notifications, settings) — it is not a real road-damage detection system:
- There is no camera/IMU sensor pipeline. Report severity comes from a lookup table on the damage-type you select, not computer vision.
- The map is st
Tracks Applied (1)
Hardware
Technologies used
