# sarvadak12/roadwatch architecture

> Architecture diagram of the GitHub repository sarvadak12/roadwatch, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sarvadak12/roadwatch
- Repository: https://github.com/sarvadak12/roadwatch

## Overview

RoadWatch is a road-damage reporting and monitoring application: users can upload road images for damage analysis, browse road conditions and history, and submit or review community reports. The frontend also provides account, notification, profile, and administrative experiences. The sampled backend implements YOLO-based inference and quality scoring. Routing and authentication links are visible in excerpts; several page-to-service and frontend-to-inference connections are not, so those are shown as unverified where useful.

Main entry points: [`frontend/src/App.jsx`](https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/App.jsx) (Application router), [`backend/app.py`](https://github.com/sarvadak12/roadwatch/blob/main/backend/app.py) (Damage inference API), [`frontend/src/pages/Upload.jsx`](https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/pages/Upload.jsx) (Image upload), [`frontend/src/services/api.js`](https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/services/api.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_navigation["App and navigation"]
  node_app["Application router<br/>[App.jsx]"]
  node_scroll["Scroll handling<br/>[ScrollToTop.jsx]"]
  node_notfound["Not-found page<br/>[PageNotFound.jsx]"]
end

subgraph group_analysis["Road analysis"]
  node_upload["Image upload<br/>[Upload.jsx]"]
  node_api["API client<br/>[api.js]"]
  node_inference["Damage inference API<br/>[app.py]"]
  node_yolo{{"YOLO model"}}
  node_detection["Detection results"]
end

subgraph group_records["Road records"]
  node_map["Road map<br/>[RoadMap.jsx]"]
  node_history["Road history<br/>[RoadHistory.jsx]"]
  node_tracking["Deterioration tracking"]
  node_reports["Community reports<br/>[Reports.jsx]"]
  node_reportdetail["Report detail<br/>[ReportDetail.jsx]"]
  node_reportform["Damage report form"]
end

subgraph group_accounts["Accounts and operations"]
  node_auth["Login and registration<br/>[AuthShell.jsx]"]
  node_supabase{{"Supabase auth"}}
  node_notifications["Notifications<br/>[Notifications.jsx]"]
  node_profile["User profile<br/>[Profile.jsx]"]
  node_admin["Administration<br/>[Admin.jsx]"]
end

node_user(("RoadWatch user"))

node_user -.->|"uses"| node_app
node_app -->|"renders"| node_scroll
node_app -->|"routes to"| node_notfound
node_app -->|"routes to"| node_upload
node_app -->|"routes to"| node_map
node_app -->|"routes to"| node_history
node_app -->|"routes to"| node_tracking
node_app -->|"routes to"| node_reports
node_app -->|"routes to"| node_reportdetail
node_app -->|"routes to"| node_reportform
node_app -->|"routes to"| node_notifications
node_app -->|"routes to"| node_profile
node_app -->|"routes to"| node_admin
node_app -->|"routes to"| node_auth
node_auth -->|"authenticates with"| node_supabase
node_upload -.->|"submits image"| node_api
node_api -.->|"requests analysis"| node_inference
node_inference -->|"runs inference"| node_yolo
node_inference -.->|"returns detections"| node_detection

click node_app "https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/App.jsx"
click node_scroll "https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/components/ScrollToTop.jsx"
click node_notfound "https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/lib/PageNotFound.jsx"
click node_auth "https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/components/auth/AuthShell.jsx"
click node_upload "https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/pages/Upload.jsx"
click node_api "https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/services/api.js"
click node_inference "https://github.com/sarvadak12/roadwatch/blob/main/backend/app.py"
click node_detection "https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/components/roadwatch/DetectionResult.jsx"
click node_map "https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/pages/RoadMap.jsx"
click node_history "https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/pages/RoadHistory.jsx"
click node_tracking "https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/pages/DeteriorationTracking.jsx"
click node_reports "https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/pages/Reports.jsx"
click node_reportdetail "https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/pages/ReportDetail.jsx"
click node_reportform "https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/pages/ReportRoadDamage.jsx"
click node_notifications "https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/pages/Notifications.jsx"
click node_profile "https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/pages/Profile.jsx"
click node_admin "https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/pages/Admin.jsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_scroll,node_notfound,node_user toneBlue
class node_upload,node_api,node_inference,node_yolo,node_detection toneAmber
class node_map,node_history,node_tracking,node_reports,node_reportdetail,node_reportform toneMint
class node_auth,node_supabase,node_notifications,node_profile,node_admin toneRose
```

## Components

### App and navigation

- [Application router](https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Scroll handling](https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/components/ScrollToTop.jsx): `frontend/src/components/ScrollToTop.jsx`
- [Not-found page](https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/lib/PageNotFound.jsx): `frontend/src/lib/PageNotFound.jsx`

### Road analysis

- [Image upload](https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/pages/Upload.jsx): `frontend/src/pages/Upload.jsx`
- [API client](https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Damage inference API](https://github.com/sarvadak12/roadwatch/blob/main/backend/app.py): `backend/app.py`
- **YOLO model**
- [Detection results](https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/components/roadwatch/DetectionResult.jsx): `frontend/src/components/roadwatch/DetectionResult.jsx`

### Road records

- [Road map](https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/pages/RoadMap.jsx): `frontend/src/pages/RoadMap.jsx`
- [Road history](https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/pages/RoadHistory.jsx): `frontend/src/pages/RoadHistory.jsx`
- [Deterioration tracking](https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/pages/DeteriorationTracking.jsx): `frontend/src/pages/DeteriorationTracking.jsx`
- [Community reports](https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/pages/Reports.jsx): `frontend/src/pages/Reports.jsx`
- [Report detail](https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/pages/ReportDetail.jsx): `frontend/src/pages/ReportDetail.jsx`
- [Damage report form](https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/pages/ReportRoadDamage.jsx): `frontend/src/pages/ReportRoadDamage.jsx`

### Accounts and operations

- [Login and registration](https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/components/auth/AuthShell.jsx): `frontend/src/components/auth/AuthShell.jsx`
- **Supabase auth**
- [Notifications](https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/pages/Notifications.jsx): `frontend/src/pages/Notifications.jsx`
- [User profile](https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/pages/Profile.jsx): `frontend/src/pages/Profile.jsx`
- [Administration](https://github.com/sarvadak12/roadwatch/blob/main/frontend/src/pages/Admin.jsx): `frontend/src/pages/Admin.jsx`

### Other components

- **RoadWatch user**

## Connections

- RoadWatch user → Application router: uses
- Application router → Scroll handling: renders (evidence: `frontend/src/App.jsx`)
- Application router → Not-found page: routes to (evidence: `frontend/src/App.jsx`)
- Application router → Image upload: routes to (evidence: `frontend/src/App.jsx`)
- Application router → Road map: routes to (evidence: `frontend/src/App.jsx`)
- Application router → Road history: routes to (evidence: `frontend/src/App.jsx`)
- Application router → Deterioration tracking: routes to (evidence: `frontend/src/App.jsx`)
- Application router → Community reports: routes to (evidence: `frontend/src/App.jsx`)
- Application router → Report detail: routes to (evidence: `frontend/src/App.jsx`)
- Application router → Damage report form: routes to (evidence: `frontend/src/App.jsx`)
- Application router → Notifications: routes to (evidence: `frontend/src/App.jsx`)
- Application router → User profile: routes to (evidence: `frontend/src/App.jsx`)
- Application router → Administration: routes to (evidence: `frontend/src/App.jsx`)
- Application router → Login and registration: routes to (evidence: `frontend/src/App.jsx`)
- Login and registration → Supabase auth: authenticates with (evidence: `frontend/src/components/auth/AuthShell.jsx`)
- Image upload → API client: submits image
- API client → Damage inference API: requests analysis
- Damage inference API → YOLO model: runs inference (evidence: `backend/app.py`)
- Damage inference API → Detection results: returns detections
