# gchaitanyasai21-design/pravaah-360 architecture

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

- Interactive diagram: https://gitdiagram.com/gchaitanyasai21-design/pravaah-360
- Repository: https://github.com/gchaitanyasai21-design/pravaah-360

## Overview

Pravaah-360 is an emergency-response and safety platform with ambulance dispatch, traffic-junction control, live mapping, and role-specific services such as child, elder, women’s-safety, and parcel tracking. The principal emergency workflow is an SOS request that creates an emergency, looks up an available ambulance, assigns it, updates its status, and creates an alert. The graph also captures the app’s role-based interfaces and its traffic and persistence layers. Some routes and views were not sampled; their inclusion reflects the source tree, while uncertain connections are omitted.

Main entry points: [`src/store/AppContext.tsx`](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/store/AppContext.tsx) (Application State), [`src/components/LiveMap.tsx`](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/components/LiveMap.tsx) (Live Map), [`src/db/access.ts`](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/db/access.ts) (Database Access), [`src/store/AuthContext.tsx`](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/store/AuthContext.tsx) (Authentication State)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User Experiences"]
  node_login["Login<br/>[page.tsx]"]
  node_admin["Admin Console<br/>[page.tsx]"]
  node_dispatch["Dispatch View<br/>[DispatchView.tsx]"]
  node_driver["Driver View<br/>[DriverView.tsx]"]
  node_patient["Patient View<br/>[PatientView.tsx]"]
  node_child["Child Safety<br/>[page.tsx]"]
  node_parent["Parental View<br/>[ParentalView.tsx]"]
  node_elder["Elder Care<br/>[page.tsx]"]
  node_women["Women’s Safety<br/>[page.tsx]"]
  node_parcel["Parcel Tracking<br/>[ParcelView.tsx]"]
  node_trafficview["Traffic View<br/>[TrafficView.tsx]"]
end

subgraph group_response["Emergency Response"]
  node_emergencyapi["Emergency API<br/>[route.ts]"]
  node_ambulanceapi["Ambulance API<br/>[route.ts]"]
  node_hospitalapi["Hospital API<br/>[route.ts]"]
end

subgraph group_traffic["Traffic Operations"]
  node_junctionapi["Junction API<br/>[route.ts]"]
  node_preemptionapi["Preemption Logs<br/>[route.ts]"]
  node_metricsapi["Metrics API<br/>[route.ts]"]
end

subgraph group_platform["Shared Platform"]
  node_appstate["Application State<br/>[AppContext.tsx]"]
  node_auth["Authentication State<br/>[AuthContext.tsx]"]
  node_map["Live Map<br/>[LiveMap.tsx]"]
  node_mapinner["Map Renderer<br/>[LiveMapInner.tsx]"]
  node_realtime["Location Utilities<br/>[realtime.ts]"]
  node_geo["Geospatial Utilities<br/>[geo.ts]"]
  node_access["Database Access<br/>[access.ts]"]
  node_database[("Application Database<br/>[index.ts]")]
  node_schema["Data Schema<br/>[schema.ts]"]
end

node_user(("Platform User"))

node_user -.->|"uses"| node_login
node_login -->|"uses"| node_auth
node_admin -->|"uses"| node_appstate
node_admin -->|"uses"| node_auth
node_admin -->|"renders"| node_map
node_child -->|"uses"| node_appstate
node_child -->|"uses"| node_auth
node_child -->|"renders"| node_map
node_child -->|"uses"| node_realtime
node_parent -->|"uses"| node_appstate
node_parent -->|"uses"| node_auth
node_parent -->|"renders"| node_map
node_parent -->|"uses"| node_realtime
node_elder -->|"uses"| node_appstate
node_elder -->|"uses"| node_auth
node_women -->|"renders"| node_map
node_parcel -->|"uses"| node_appstate
node_parcel -->|"uses"| node_auth
node_parcel -->|"renders"| node_map
node_dispatch -->|"uses"| node_appstate
node_dispatch -->|"uses"| node_auth
node_dispatch -->|"renders"| node_map
node_trafficview -->|"uses"| node_appstate
node_trafficview -->|"renders"| node_map
node_emergencyapi -->|"calls"| node_access
node_ambulanceapi -->|"queries"| node_database
node_hospitalapi -->|"calls"| node_access
node_junctionapi -->|"calls"| node_access
node_preemptionapi -->|"calls"| node_access
node_metricsapi -->|"calls"| node_access
node_access -->|"queries"| node_database
node_access -->|"uses"| node_schema
node_map -->|"loads"| node_mapinner
node_appstate -->|"calls"| node_geo

click node_login "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/app/login/page.tsx"
click node_admin "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/app/admin/page.tsx"
click node_dispatch "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/views/DispatchView.tsx"
click node_driver "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/views/DriverView.tsx"
click node_patient "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/views/PatientView.tsx"
click node_child "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/app/child/page.tsx"
click node_parent "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/views/ParentalView.tsx"
click node_elder "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/app/eldercare/page.tsx"
click node_women "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/app/womensafety/page.tsx"
click node_parcel "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/views/ParcelView.tsx"
click node_trafficview "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/views/TrafficView.tsx"
click node_emergencyapi "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/app/api/emergencies/route.ts"
click node_ambulanceapi "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/app/api/ambulances/route.ts"
click node_hospitalapi "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/app/api/hospitals/route.ts"
click node_junctionapi "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/app/api/junctions/route.ts"
click node_preemptionapi "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/app/api/logs/preemptions/route.ts"
click node_metricsapi "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/app/api/metrics/route.ts"
click node_appstate "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/store/AppContext.tsx"
click node_auth "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/store/AuthContext.tsx"
click node_map "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/components/LiveMap.tsx"
click node_mapinner "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/components/LiveMapInner.tsx"
click node_realtime "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/lib/realtime.ts"
click node_geo "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/utils/geo.ts"
click node_access "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/db/access.ts"
click node_database "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/db/index.ts"
click node_schema "https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/db/schema.ts"

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_login,node_admin,node_dispatch,node_driver,node_patient,node_child,node_parent,node_elder,node_women,node_parcel,node_trafficview,node_user toneBlue
class node_emergencyapi,node_ambulanceapi,node_hospitalapi toneAmber
class node_junctionapi,node_preemptionapi,node_metricsapi toneMint
class node_appstate,node_auth,node_map,node_mapinner,node_realtime,node_geo,node_access,node_database,node_schema toneRose
```

## Components

### User Experiences

- [Login](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/app/login/page.tsx): `src/app/login/page.tsx`
- [Admin Console](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/app/admin/page.tsx): `src/app/admin/page.tsx`
- [Dispatch View](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/views/DispatchView.tsx): `src/views/DispatchView.tsx`
- [Driver View](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/views/DriverView.tsx): `src/views/DriverView.tsx`
- [Patient View](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/views/PatientView.tsx): `src/views/PatientView.tsx`
- [Child Safety](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/app/child/page.tsx): `src/app/child/page.tsx`
- [Parental View](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/views/ParentalView.tsx): `src/views/ParentalView.tsx`
- [Elder Care](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/app/eldercare/page.tsx): `src/app/eldercare/page.tsx`
- [Women’s Safety](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/app/womensafety/page.tsx): `src/app/womensafety/page.tsx`
- [Parcel Tracking](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/views/ParcelView.tsx): `src/views/ParcelView.tsx`
- [Traffic View](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/views/TrafficView.tsx): `src/views/TrafficView.tsx`

### Emergency Response

- [Emergency API](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/app/api/emergencies/route.ts): `src/app/api/emergencies/route.ts`
- [Ambulance API](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/app/api/ambulances/route.ts): `src/app/api/ambulances/route.ts`
- [Hospital API](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/app/api/hospitals/route.ts): `src/app/api/hospitals/route.ts`

### Traffic Operations

- [Junction API](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/app/api/junctions/route.ts): `src/app/api/junctions/route.ts`
- [Preemption Logs](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/app/api/logs/preemptions/route.ts): `src/app/api/logs/preemptions/route.ts`
- [Metrics API](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/app/api/metrics/route.ts): `src/app/api/metrics/route.ts`

### Shared Platform

- [Application State](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/store/AppContext.tsx): `src/store/AppContext.tsx`
- [Authentication State](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/store/AuthContext.tsx): `src/store/AuthContext.tsx`
- [Live Map](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/components/LiveMap.tsx): `src/components/LiveMap.tsx`
- [Map Renderer](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/components/LiveMapInner.tsx): `src/components/LiveMapInner.tsx`
- [Location Utilities](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/lib/realtime.ts): `src/lib/realtime.ts`
- [Geospatial Utilities](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/utils/geo.ts): `src/utils/geo.ts`
- [Database Access](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/db/access.ts): `src/db/access.ts`
- [Application Database](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/db/index.ts): `src/db/index.ts`
- [Data Schema](https://github.com/gchaitanyasai21-design/pravaah-360/blob/main/src/db/schema.ts): `src/db/schema.ts`

### Other components

- **Platform User**

## Connections

- Platform User → Login: uses
- Login → Authentication State: uses (evidence: `src/app/login/page.tsx`)
- Admin Console → Application State: uses (evidence: `src/app/admin/page.tsx`)
- Admin Console → Authentication State: uses (evidence: `src/app/admin/page.tsx`)
- Admin Console → Live Map: renders (evidence: `src/app/admin/page.tsx`)
- Child Safety → Application State: uses (evidence: `src/app/child/page.tsx`)
- Child Safety → Authentication State: uses (evidence: `src/app/child/page.tsx`)
- Child Safety → Live Map: renders (evidence: `src/app/child/page.tsx`)
- Child Safety → Location Utilities: uses (evidence: `src/app/child/page.tsx`)
- Parental View → Application State: uses (evidence: `src/views/ParentalView.tsx`)
- Parental View → Authentication State: uses (evidence: `src/views/ParentalView.tsx`)
- Parental View → Live Map: renders (evidence: `src/views/ParentalView.tsx`)
- Parental View → Location Utilities: uses
- Elder Care → Application State: uses (evidence: `src/app/eldercare/page.tsx`)
- Elder Care → Authentication State: uses (evidence: `src/app/eldercare/page.tsx`)
- Women’s Safety → Live Map: renders (evidence: `src/app/womensafety/page.tsx`)
- Parcel Tracking → Application State: uses (evidence: `src/views/ParcelView.tsx`)
- Parcel Tracking → Authentication State: uses (evidence: `src/views/ParcelView.tsx`)
- Parcel Tracking → Live Map: renders (evidence: `src/views/ParcelView.tsx`)
- Dispatch View → Application State: uses (evidence: `src/views/DispatchView.tsx`)
- Dispatch View → Authentication State: uses (evidence: `src/views/DispatchView.tsx`)
- Dispatch View → Live Map: renders (evidence: `src/views/DispatchView.tsx`)
- Traffic View → Application State: uses (evidence: `src/views/TrafficView.tsx`)
- Traffic View → Live Map: renders (evidence: `src/views/TrafficView.tsx`)
- Emergency API → Database Access: calls (evidence: `src/app/api/emergencies/route.ts`)
- Ambulance API → Application Database: queries (evidence: `src/app/api/ambulances/route.ts`)
- Hospital API → Database Access: calls (evidence: `src/app/api/hospitals/route.ts`)
- Junction API → Database Access: calls (evidence: `src/app/api/junctions/route.ts`)
- Preemption Logs → Database Access: calls (evidence: `src/app/api/logs/preemptions/route.ts`)
- Metrics API → Database Access: calls (evidence: `src/app/api/metrics/route.ts`)
- Database Access → Application Database: queries (evidence: `src/db/access.ts`)
- Database Access → Data Schema: uses (evidence: `src/db/access.ts`)
- Live Map → Map Renderer: loads (evidence: `src/components/LiveMap.tsx`)
- Application State → Geospatial Utilities: calls (evidence: `src/store/AppContext.tsx`)
