# manideep230/smart-city architecture

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

- Interactive diagram: https://gitdiagram.com/manideep230/smart-city
- Repository: https://github.com/manideep230/smart-city

## Overview

CriminalWatch is a police surveillance and identity-management application, with a separate cloak-room/pod workflow. Officers register people and biometric data, monitor camera feeds, review sightings and receive alerts; maintainers enroll and verify customers before locker or pod retrieval. The graph separates browser workflows, Flask API handling, recognition/alert services and persistent state. The README documents the main surveillance endpoints and real-time/email alerts; sampled source confirms several implementation details, but unsampled route-to-service wiring is not shown where uncertain.

Main entry points: [`backend/app.py`](https://github.com/manideep230/smart-city/blob/main/backend/app.py) (Flask application), [`backend/models`](https://github.com/manideep230/smart-city/tree/main/backend/models) (Surveillance records), [`frontend/src/App.jsx`](https://github.com/manideep230/smart-city/blob/main/frontend/src/App.jsx) (Route and role UI), [`backend/services/face_engine.py`](https://github.com/manideep230/smart-city/blob/main/backend/services/face_engine.py) (Live recognition)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Web application"]
  node_appui["Route and role UI<br/>[App.jsx]"]
  node_surveillanceui["Surveillance screens"]
  node_cloakui["Cloak workflows"]
  node_facecapture["Face capture<br/>[FaceCapture.jsx]"]
  node_clientapi["HTTP API client<br/>[api.js]"]
  node_socketclient["Realtime client<br/>[socket.js]"]
end

subgraph group_api["Backend API"]
  node_flask["Flask application<br/>[app.py]"]
  node_authroutes["Authentication<br/>[auth.py]"]
  node_criminalroutes["People and status API<br/>[criminals.py]"]
  node_cameraroutes["Camera API<br/>[cameras.py]"]
  node_sightingroutes["Sightings API<br/>[sightings.py]"]
  node_cloakroutes["Cloak and pod API<br/>[cloak_room.py]"]
  node_adminroutes["Database administration<br/>[db_admin.py]"]
end

subgraph group_recognition["Recognition and alerts"]
  node_faceengine["Live recognition<br/>[face_engine.py]"]
  node_cloakface["Cloak biometrics"]
  node_alerts["Alert delivery<br/>[alert_service.py]"]
end

subgraph group_domain["Domain state"]
  node_domainmodels[("Surveillance records")]
  node_cloakmodels[("Locker and session records<br/>[cloak_room.py]")]
  node_mongodb[("MongoDB")]
end

node_police(("Police staff"))
node_maintainer(("Cloak/pod maintainer"))
node_camera(("Camera feed"))
node_email(("SMTP email"))
node_socket(("Dashboard clients"))

node_police -->|"uses"| node_appui
node_maintainer -->|"uses"| node_appui
node_appui -->|"routes to"| node_surveillanceui
node_appui -->|"routes to"| node_cloakui
node_surveillanceui -->|"requests data"| node_clientapi
node_cloakui -->|"calls endpoints"| node_clientapi
node_cloakui -->|"captures frames"| node_facecapture
node_facecapture -->|"submits frames"| node_clientapi
node_clientapi -->|"HTTP requests"| node_flask
node_socketclient -->|"realtime connection"| node_flask
node_flask -->|"dispatches"| node_authroutes
node_flask -->|"dispatches"| node_criminalroutes
node_flask -->|"dispatches"| node_cameraroutes
node_flask -->|"dispatches"| node_sightingroutes
node_flask -->|"dispatches"| node_cloakroutes
node_flask -->|"dispatches"| node_adminroutes
node_authroutes -->|"reads/writes users"| node_domainmodels
node_criminalroutes -->|"reads/writes people"| node_domainmodels
node_sightingroutes -->|"reads sightings"| node_domainmodels
node_cameraroutes -->|"starts monitoring"| node_faceengine
node_camera -->|"provides video"| node_faceengine
node_faceengine -->|"matches and records"| node_domainmodels
node_faceengine -->|"sends match alert"| node_alerts
node_alerts -->|"emits alerts"| node_socket
node_alerts -.->|"sends email"| node_email
node_cloakroutes -->|"reads/writes sessions"| node_cloakmodels
node_adminroutes -->|"exports/restores data"| node_mongodb
node_cloakmodels -->|"persists sessions"| node_mongodb
node_domainmodels -->|"persists records"| node_mongodb

click node_appui "https://github.com/manideep230/smart-city/blob/main/frontend/src/App.jsx"
click node_surveillanceui "https://github.com/manideep230/smart-city/tree/main/frontend/src/pages"
click node_cloakui "https://github.com/manideep230/smart-city/tree/main/frontend/src/pages/cloak"
click node_facecapture "https://github.com/manideep230/smart-city/blob/main/frontend/src/components/FaceCapture.jsx"
click node_clientapi "https://github.com/manideep230/smart-city/blob/main/frontend/src/services/api.js"
click node_socketclient "https://github.com/manideep230/smart-city/blob/main/frontend/src/services/socket.js"
click node_flask "https://github.com/manideep230/smart-city/blob/main/backend/app.py"
click node_authroutes "https://github.com/manideep230/smart-city/blob/main/backend/routes/auth.py"
click node_criminalroutes "https://github.com/manideep230/smart-city/blob/main/backend/routes/criminals.py"
click node_cameraroutes "https://github.com/manideep230/smart-city/blob/main/backend/routes/cameras.py"
click node_sightingroutes "https://github.com/manideep230/smart-city/blob/main/backend/routes/sightings.py"
click node_cloakroutes "https://github.com/manideep230/smart-city/blob/main/backend/routes/cloak_room.py"
click node_adminroutes "https://github.com/manideep230/smart-city/blob/main/backend/routes/db_admin.py"
click node_faceengine "https://github.com/manideep230/smart-city/blob/main/backend/services/face_engine.py"
click node_cloakface "https://github.com/manideep230/smart-city/blob/main/backend/services/cloak_face_service.py"
click node_alerts "https://github.com/manideep230/smart-city/blob/main/backend/services/alert_service.py"
click node_domainmodels "https://github.com/manideep230/smart-city/tree/main/backend/models"
click node_cloakmodels "https://github.com/manideep230/smart-city/blob/main/backend/models/cloak_room.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_appui,node_surveillanceui,node_cloakui,node_facecapture,node_clientapi,node_socketclient,node_socket toneBlue
class node_flask,node_authroutes,node_criminalroutes,node_cameraroutes,node_sightingroutes,node_cloakroutes,node_adminroutes toneAmber
class node_faceengine,node_cloakface,node_alerts toneMint
class node_domainmodels,node_cloakmodels,node_mongodb toneRose
class node_police,node_maintainer,node_camera,node_email toneIndigo
```

## Components

### Web application

- [Route and role UI](https://github.com/manideep230/smart-city/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Surveillance screens](https://github.com/manideep230/smart-city/tree/main/frontend/src/pages): `frontend/src/pages`
- [Cloak workflows](https://github.com/manideep230/smart-city/tree/main/frontend/src/pages/cloak): `frontend/src/pages/cloak`
- [Face capture](https://github.com/manideep230/smart-city/blob/main/frontend/src/components/FaceCapture.jsx): `frontend/src/components/FaceCapture.jsx`
- [HTTP API client](https://github.com/manideep230/smart-city/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Realtime client](https://github.com/manideep230/smart-city/blob/main/frontend/src/services/socket.js): `frontend/src/services/socket.js`

### Backend API

- [Flask application](https://github.com/manideep230/smart-city/blob/main/backend/app.py): `backend/app.py`
- [Authentication](https://github.com/manideep230/smart-city/blob/main/backend/routes/auth.py): `backend/routes/auth.py`
- [People and status API](https://github.com/manideep230/smart-city/blob/main/backend/routes/criminals.py): `backend/routes/criminals.py`
- [Camera API](https://github.com/manideep230/smart-city/blob/main/backend/routes/cameras.py): `backend/routes/cameras.py`
- [Sightings API](https://github.com/manideep230/smart-city/blob/main/backend/routes/sightings.py): `backend/routes/sightings.py`
- [Cloak and pod API](https://github.com/manideep230/smart-city/blob/main/backend/routes/cloak_room.py): `backend/routes/cloak_room.py`
- [Database administration](https://github.com/manideep230/smart-city/blob/main/backend/routes/db_admin.py): `backend/routes/db_admin.py`

### Recognition and alerts

- [Live recognition](https://github.com/manideep230/smart-city/blob/main/backend/services/face_engine.py): `backend/services/face_engine.py`
- [Cloak biometrics](https://github.com/manideep230/smart-city/blob/main/backend/services/cloak_face_service.py): `backend/services/cloak_face_service.py`
- [Alert delivery](https://github.com/manideep230/smart-city/blob/main/backend/services/alert_service.py): `backend/services/alert_service.py`

### Domain state

- [Surveillance records](https://github.com/manideep230/smart-city/tree/main/backend/models): `backend/models`
- [Locker and session records](https://github.com/manideep230/smart-city/blob/main/backend/models/cloak_room.py): `backend/models/cloak_room.py`
- **MongoDB**

### Other components

- **Police staff**
- **Cloak/pod maintainer**
- **Camera feed**
- **SMTP email**
- **Dashboard clients**

## Connections

- Police staff → Route and role UI: uses
- Cloak/pod maintainer → Route and role UI: uses
- Route and role UI → Surveillance screens: routes to
- Route and role UI → Cloak workflows: routes to
- Surveillance screens → HTTP API client: requests data
- Cloak workflows → HTTP API client: calls endpoints
- Cloak workflows → Face capture: captures frames
- Face capture → HTTP API client: submits frames
- HTTP API client → Flask application: HTTP requests
- Realtime client → Flask application: realtime connection
- Flask application → Authentication: dispatches
- Flask application → People and status API: dispatches
- Flask application → Camera API: dispatches
- Flask application → Sightings API: dispatches
- Flask application → Cloak and pod API: dispatches
- Flask application → Database administration: dispatches
- Authentication → Surveillance records: reads/writes users
- People and status API → Surveillance records: reads/writes people
- Sightings API → Surveillance records: reads sightings
- Camera API → Live recognition: starts monitoring
- Camera feed → Live recognition: provides video
- Live recognition → Surveillance records: matches and records
- Live recognition → Alert delivery: sends match alert
- Alert delivery → Dashboard clients: emits alerts
- Alert delivery → SMTP email: sends email
- Cloak and pod API → Locker and session records: reads/writes sessions
- Database administration → MongoDB: exports/restores data
- Locker and session records → MongoDB: persists sessions
- Surveillance records → MongoDB: persists records
