# nandan636/e-challan architecture

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

- Interactive diagram: https://gitdiagram.com/nandan636/e-challan
- Repository: https://github.com/nandan636/e-challan

## Overview

E-Challan supports citizen violation and accident reporting, police review, and related community and vehicle-service workflows. The primary flow is a citizen submitting evidence and details, with optional plate recognition, followed by police status decisions and dashboard reporting. The React application and Express API are concentrated in single files; the sampled excerpts support these connections, while some routes and UI wiring are only documented or partially shown.

Main entry points: [`backend/server.js`](https://github.com/nandan636/e-challan/blob/main/backend/server.js) (Express API), [`frontend/src/App.jsx`](https://github.com/nandan636/e-challan/blob/main/frontend/src/App.jsx) (React app), [`ai_service/app.py`](https://github.com/nandan636/e-challan/blob/main/ai_service/app.py) (Plate OCR)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_web_app["React app<br/>[App.jsx]"]
  node_reporting["Violation reporting<br/>[App.jsx]"]
  node_police_dashboard["Police dashboard<br/>[App.jsx]"]
  node_community["Stats and leaderboard<br/>[App.jsx]"]
  node_service_ui["Service requests<br/>[App.jsx]"]
  node_accident_ui["Accident reporting<br/>[App.jsx]"]
end

subgraph group_api["Traffic API"]
  node_traffic_api["Express API<br/>[server.js]"]
  node_auth["Account handling<br/>[server.js]"]
  node_challans["Violation management<br/>[server.js]"]
  node_service_requests["Service request handling<br/>[server.js]"]
  node_accidents["Accident reports<br/>[server.js]"]
end

subgraph group_ai["Plate recognition"]
  node_recognition["Plate OCR<br/>[app.py]"]
end

subgraph group_state["Persistent state"]
  node_mongo[("MongoDB")]
end

node_citizen(("Citizen"))
node_officer(("Police officer"))
node_service_shop(("Service shop"))

node_citizen -->|"uses"| node_web_app
node_officer -->|"uses"| node_web_app
node_service_shop -.->|"uses"| node_web_app
node_web_app -->|"presents"| node_reporting
node_web_app -->|"presents"| node_police_dashboard
node_web_app -->|"presents"| node_community
node_web_app -->|"presents"| node_service_ui
node_web_app -->|"presents"| node_accident_ui
node_reporting -->|"sends image"| node_recognition
node_reporting -->|"submits report"| node_traffic_api
node_police_dashboard -->|"requests and updates"| node_traffic_api
node_community -->|"requests stats"| node_traffic_api
node_service_ui -->|"manages requests"| node_traffic_api
node_accident_ui -->|"submits and lists"| node_traffic_api
node_traffic_api -->|"dispatches"| node_auth
node_traffic_api -->|"dispatches"| node_challans
node_traffic_api -->|"dispatches"| node_service_requests
node_traffic_api -->|"dispatches"| node_accidents
node_auth -->|"reads and writes"| node_mongo
node_challans -->|"reads and writes"| node_mongo
node_service_requests -->|"reads and writes"| node_mongo
node_accidents -->|"reads and writes"| node_mongo

click node_web_app "https://github.com/nandan636/e-challan/blob/main/frontend/src/App.jsx"
click node_reporting "https://github.com/nandan636/e-challan/blob/main/frontend/src/App.jsx"
click node_police_dashboard "https://github.com/nandan636/e-challan/blob/main/frontend/src/App.jsx"
click node_community "https://github.com/nandan636/e-challan/blob/main/frontend/src/App.jsx"
click node_service_ui "https://github.com/nandan636/e-challan/blob/main/frontend/src/App.jsx"
click node_accident_ui "https://github.com/nandan636/e-challan/blob/main/frontend/src/App.jsx"
click node_traffic_api "https://github.com/nandan636/e-challan/blob/main/backend/server.js"
click node_auth "https://github.com/nandan636/e-challan/blob/main/backend/server.js"
click node_challans "https://github.com/nandan636/e-challan/blob/main/backend/server.js"
click node_service_requests "https://github.com/nandan636/e-challan/blob/main/backend/server.js"
click node_accidents "https://github.com/nandan636/e-challan/blob/main/backend/server.js"
click node_recognition "https://github.com/nandan636/e-challan/blob/main/ai_service/app.py"

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_web_app,node_reporting,node_police_dashboard,node_community,node_service_ui,node_accident_ui toneBlue
class node_traffic_api,node_auth,node_challans,node_service_requests,node_accidents toneAmber
class node_recognition toneMint
class node_mongo toneRose
class node_citizen,node_officer,node_service_shop toneIndigo
```

## Components

### Web application

- [React app](https://github.com/nandan636/e-challan/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Violation reporting](https://github.com/nandan636/e-challan/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Police dashboard](https://github.com/nandan636/e-challan/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Stats and leaderboard](https://github.com/nandan636/e-challan/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Service requests](https://github.com/nandan636/e-challan/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Accident reporting](https://github.com/nandan636/e-challan/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`

### Traffic API

- [Express API](https://github.com/nandan636/e-challan/blob/main/backend/server.js): `backend/server.js`
- [Account handling](https://github.com/nandan636/e-challan/blob/main/backend/server.js): `backend/server.js`
- [Violation management](https://github.com/nandan636/e-challan/blob/main/backend/server.js): `backend/server.js`
- [Service request handling](https://github.com/nandan636/e-challan/blob/main/backend/server.js): `backend/server.js`
- [Accident reports](https://github.com/nandan636/e-challan/blob/main/backend/server.js): `backend/server.js`

### Plate recognition

- [Plate OCR](https://github.com/nandan636/e-challan/blob/main/ai_service/app.py): `ai_service/app.py`

### Persistent state

- **MongoDB**

### Other components

- **Citizen**
- **Police officer**
- **Service shop**

## Connections

- Citizen → React app: uses
- Police officer → React app: uses
- Service shop → React app: uses
- React app → Violation reporting: presents
- React app → Police dashboard: presents
- React app → Stats and leaderboard: presents
- React app → Service requests: presents
- React app → Accident reporting: presents
- Violation reporting → Plate OCR: sends image
- Violation reporting → Express API: submits report
- Police dashboard → Express API: requests and updates
- Stats and leaderboard → Express API: requests stats
- Service requests → Express API: manages requests
- Accident reporting → Express API: submits and lists
- Express API → Account handling: dispatches
- Express API → Violation management: dispatches
- Express API → Service request handling: dispatches
- Express API → Accident reports: dispatches
- Account handling → MongoDB: reads and writes
- Violation management → MongoDB: reads and writes
- Service request handling → MongoDB: reads and writes
- Accident reports → MongoDB: reads and writes
