# skygod07/drashti architecture

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

- Interactive diagram: https://gitdiagram.com/skygod07/drashti
- Repository: https://github.com/skygod07/drashti

## Overview

DRASHTI is a hybrid camera-registry and surveillance-viewing platform. In the running user workflow, an officer opens the React app, which requests health and camera data through its API client; the FastAPI service returns sample registry data. The backend also exposes a spike HLS file-serving route, while feed adapters can publish real or demo video into an RTSP hub. The README describes broader planned GIS, ANPR, watchlist, alert, and investigation capabilities; those are distinguished below from the currently evidenced workflow. Unsampled planned subsystems use only supported enclosing paths.

Main entry points: [`backend/app/main.py`](https://github.com/skygod07/drashti/blob/main/backend/app/main.py) (FastAPI App), [`frontend/src/services/api.ts`](https://github.com/skygod07/drashti/blob/main/frontend/src/services/api.ts) (API Client), [`backend/app/api/cameras.py`](https://github.com/skygod07/drashti/blob/main/backend/app/api/cameras.py) (Camera Registry API), [`backend/app/services`](https://github.com/skygod07/drashti/tree/main/backend/app/services) (GIS & Investigation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Officer Client"]
  node_app["React App<br/>[App.tsx]"]
  node_api_client["API Client<br/>[api.ts]"]
end

subgraph group_api["API Service"]
  node_api_main["FastAPI App<br/>[main.py]"]
  node_health["Health Route<br/>[health.py]"]
  node_camera_api["Camera Registry API<br/>[cameras.py]"]
  node_media_api["HLS File Route<br/>[media.py]"]
  node_domain_api["Domain APIs"]
end

subgraph group_video["Video Ingestion"]
  node_ingestion["Feed Adapters<br/>[ingestion.py]"]
  node_rtsp_hub["MediaMTX RTSP Hub"]
  node_transcode["FFmpeg Transcode"]
  node_hls_files[("HLS Output")]
end

subgraph group_domain["Investigation Domain"]
  node_anpr["ANPR Harness<br/>[spike_anpr.py]"]
  node_investigation["GIS &amp; Investigation"]
  node_watch_alerts["Watchlist &amp; Alerts"]
end

subgraph group_data["Data Layer"]
  node_orm[("Registry Models<br/>[orm.py]")]
  node_db_session["DB Session<br/>[db.py]"]
  node_settings["Configuration<br/>[config.py]"]
end

node_officer(("Officer"))

node_officer -->|"uses"| node_app
node_app -->|"queries"| node_api_client
node_api_client -->|"requests health"| node_health
node_api_client -->|"requests cameras"| node_camera_api
node_api_main -->|"registers"| node_health
node_api_main -->|"registers"| node_camera_api
node_api_main -->|"registers"| node_media_api
node_media_api -->|"reads files"| node_hls_files
node_ingestion -->|"publishes feeds"| node_rtsp_hub
node_ingestion -->|"starts ffmpeg"| node_transcode
node_rtsp_hub -.->|"provides stream"| node_transcode
node_transcode -.->|"writes HLS"| node_hls_files
node_anpr -.->|"supports analysis"| node_investigation
node_investigation -.->|"correlates detections"| node_watch_alerts
node_camera_api -.->|"planned persistence"| node_orm
node_db_session -->|"reads database URL"| node_settings
node_orm -.->|"planned database access"| node_db_session
node_domain_api -.->|"planned routing"| node_investigation

click node_app "https://github.com/skygod07/drashti/blob/main/frontend/src/App.tsx"
click node_api_client "https://github.com/skygod07/drashti/blob/main/frontend/src/services/api.ts"
click node_api_main "https://github.com/skygod07/drashti/blob/main/backend/app/main.py"
click node_health "https://github.com/skygod07/drashti/blob/main/backend/app/api/health.py"
click node_camera_api "https://github.com/skygod07/drashti/blob/main/backend/app/api/cameras.py"
click node_media_api "https://github.com/skygod07/drashti/blob/main/backend/app/api/media.py"
click node_ingestion "https://github.com/skygod07/drashti/blob/main/backend/app/services/ingestion.py"
click node_hls_files "https://github.com/skygod07/drashti/tree/main/infra"
click node_anpr "https://github.com/skygod07/drashti/blob/main/scripts/spike_anpr.py"
click node_investigation "https://github.com/skygod07/drashti/tree/main/backend/app/services"
click node_watch_alerts "https://github.com/skygod07/drashti/tree/main/backend/app"
click node_domain_api "https://github.com/skygod07/drashti/tree/main/backend/app/api"
click node_orm "https://github.com/skygod07/drashti/blob/main/backend/app/models/orm.py"
click node_db_session "https://github.com/skygod07/drashti/blob/main/backend/app/core/db.py"
click node_settings "https://github.com/skygod07/drashti/blob/main/backend/app/core/config.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_app,node_api_client toneBlue
class node_api_main,node_health,node_camera_api,node_media_api,node_domain_api toneAmber
class node_ingestion,node_rtsp_hub,node_transcode,node_hls_files toneMint
class node_anpr,node_investigation,node_watch_alerts toneRose
class node_orm,node_db_session,node_settings,node_officer toneIndigo
```

## Components

### Officer Client

- [React App](https://github.com/skygod07/drashti/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API Client](https://github.com/skygod07/drashti/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`

### API Service

- [FastAPI App](https://github.com/skygod07/drashti/blob/main/backend/app/main.py): `backend/app/main.py`
- [Health Route](https://github.com/skygod07/drashti/blob/main/backend/app/api/health.py): `backend/app/api/health.py`
- [Camera Registry API](https://github.com/skygod07/drashti/blob/main/backend/app/api/cameras.py): `backend/app/api/cameras.py`
- [HLS File Route](https://github.com/skygod07/drashti/blob/main/backend/app/api/media.py): `backend/app/api/media.py`
- [Domain APIs](https://github.com/skygod07/drashti/tree/main/backend/app/api): `backend/app/api`

### Video Ingestion

- [Feed Adapters](https://github.com/skygod07/drashti/blob/main/backend/app/services/ingestion.py): `backend/app/services/ingestion.py`
- **MediaMTX RTSP Hub**
- **FFmpeg Transcode**
- [HLS Output](https://github.com/skygod07/drashti/tree/main/infra): `infra`

### Investigation Domain

- [ANPR Harness](https://github.com/skygod07/drashti/blob/main/scripts/spike_anpr.py): `scripts/spike_anpr.py`
- [GIS & Investigation](https://github.com/skygod07/drashti/tree/main/backend/app/services): `backend/app/services`
- [Watchlist & Alerts](https://github.com/skygod07/drashti/tree/main/backend/app): `backend/app`

### Data Layer

- [Registry Models](https://github.com/skygod07/drashti/blob/main/backend/app/models/orm.py): `backend/app/models/orm.py`
- [DB Session](https://github.com/skygod07/drashti/blob/main/backend/app/core/db.py): `backend/app/core/db.py`
- [Configuration](https://github.com/skygod07/drashti/blob/main/backend/app/core/config.py): `backend/app/core/config.py`

### Other components

- **Officer**

## Connections

- Officer → React App: uses (evidence: `README.md`)
- React App → API Client: queries (evidence: `frontend/src/App.tsx`)
- API Client → Health Route: requests health (evidence: `frontend/src/services/api.ts`)
- API Client → Camera Registry API: requests cameras (evidence: `frontend/src/services/api.ts`)
- FastAPI App → Health Route: registers (evidence: `backend/app/main.py`)
- FastAPI App → Camera Registry API: registers (evidence: `backend/app/main.py`)
- FastAPI App → HLS File Route: registers (evidence: `backend/app/main.py`)
- HLS File Route → HLS Output: reads files (evidence: `backend/app/api/media.py`)
- Feed Adapters → MediaMTX RTSP Hub: publishes feeds (evidence: `backend/app/services/ingestion.py`)
- Feed Adapters → FFmpeg Transcode: starts ffmpeg (evidence: `backend/app/services/ingestion.py`)
- MediaMTX RTSP Hub → FFmpeg Transcode: provides stream
- FFmpeg Transcode → HLS Output: writes HLS
- ANPR Harness → GIS & Investigation: supports analysis
- GIS & Investigation → Watchlist & Alerts: correlates detections (evidence: `backend/app/services/ingestion.py`)
- Camera Registry API → Registry Models: planned persistence
- DB Session → Configuration: reads database URL (evidence: `backend/app/core/db.py`)
- Registry Models → DB Session: planned database access
- Domain APIs → GIS & Investigation: planned routing
