# smklabs/sih-pathfinding architecture

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

- Interactive diagram: https://gitdiagram.com/smklabs/sih-pathfinding
- Repository: https://github.com/smklabs/sih-pathfinding

## Overview

Sahayata is a mobile-first Delhi NCR emergency coordination app. Residents can request help, register households, find shelter and evacuation guidance, and access recovery workflows; coordinators manage incidents and dispatches, while administrators monitor alerts, shelters, and operational analytics. The React app selects role-based views, with shared incident presentation and domain constants as an internal layer. The README also documents installable/offline PWA support. Source excerpts are partial, so backend query relationships are not shown where the actual calls are unsampled.

Main entry points: [`src/App.tsx`](https://github.com/smklabs/sih-pathfinding/blob/main/src/App.tsx) (Role and theme shell), [`src/components/CivilianView.tsx`](https://github.com/smklabs/sih-pathfinding/blob/main/src/components/CivilianView.tsx) (Resident workflows), [`src/components/CoordinatorView.tsx`](https://github.com/smklabs/sih-pathfinding/blob/main/src/components/CoordinatorView.tsx) (Incident coordination), [`src/components/AdminView.tsx`](https://github.com/smklabs/sih-pathfinding/blob/main/src/components/AdminView.tsx) (Administration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application shell"]
  node_entry["React entry<br/>[main.tsx]"]
  node_app_shell["Role and theme shell<br/>[App.tsx]"]
end

subgraph group_civilian["Resident response"]
  node_civilian_view["Resident workflows<br/>[CivilianView.tsx]"]
  node_sos["Emergency SOS<br/>[FloatingSOS.tsx]"]
  node_shelter_guidance["Shelter and guidance<br/>[CivilianView.tsx]"]
  node_household_recovery["Household and recovery<br/>[CivilianView.tsx]"]
end

subgraph group_operations["Coordination operations"]
  node_coordinator["Incident coordination"]
  node_dispatch["Relief dispatch tracking"]
  node_regional_alerts["Regional safety alerts"]
  node_admin["Administration<br/>[AdminView.tsx]"]
  node_shelter_capacity["Shelter capacity<br/>[AdminView.tsx]"]
  node_analytics["Operational analytics<br/>[AdminView.tsx]"]
end

subgraph group_platform["Shared platform"]
  node_shared_ui["Shared incident UI<br/>[shared.tsx]"]
  node_domain_rules["Emergency domain data<br/>[constants.ts]"]
  node_backend_client["Supabase client<br/>[supabase.ts]"]
  node_backend_store[("Platform database")]
  node_pwa_worker["Offline service worker<br/>[sw.js]"]
  node_pwa_manifest["Install metadata<br/>[manifest.json]"]
end

node_resident(("Resident / responder"))

node_resident -->|"opens app"| node_entry
node_entry -->|"renders"| node_app_shell
node_app_shell -->|"selects role"| node_civilian_view
node_app_shell -->|"selects role"| node_coordinator
node_app_shell -->|"selects role"| node_admin
node_app_shell -->|"renders"| node_sos
node_civilian_view -->|"offers SOS"| node_sos
node_civilian_view -->|"renders tab"| node_shelter_guidance
node_civilian_view -->|"renders tabs"| node_household_recovery
node_coordinator -->|"renders tab"| node_dispatch
node_coordinator -->|"shows alerts"| node_regional_alerts
node_admin -->|"renders tab"| node_shelter_capacity
node_admin -->|"renders tab"| node_analytics
node_civilian_view -->|"renders"| node_shared_ui
node_coordinator -->|"renders"| node_shared_ui
node_admin -->|"renders"| node_shared_ui
node_shared_ui -->|"formats with"| node_domain_rules
node_pwa_worker -->|"caches shell"| node_pwa_manifest
node_resident -.->|"installs app"| node_pwa_manifest

click node_entry "https://github.com/smklabs/sih-pathfinding/blob/main/src/main.tsx"
click node_app_shell "https://github.com/smklabs/sih-pathfinding/blob/main/src/App.tsx"
click node_civilian_view "https://github.com/smklabs/sih-pathfinding/blob/main/src/components/CivilianView.tsx"
click node_sos "https://github.com/smklabs/sih-pathfinding/blob/main/src/components/FloatingSOS.tsx"
click node_shelter_guidance "https://github.com/smklabs/sih-pathfinding/blob/main/src/components/CivilianView.tsx"
click node_household_recovery "https://github.com/smklabs/sih-pathfinding/blob/main/src/components/CivilianView.tsx"
click node_coordinator "https://github.com/smklabs/sih-pathfinding/blob/main/src/components/CoordinatorView.tsx"
click node_dispatch "https://github.com/smklabs/sih-pathfinding/blob/main/src/components/CoordinatorView.tsx"
click node_regional_alerts "https://github.com/smklabs/sih-pathfinding/blob/main/src/components/CoordinatorView.tsx"
click node_admin "https://github.com/smklabs/sih-pathfinding/blob/main/src/components/AdminView.tsx"
click node_shelter_capacity "https://github.com/smklabs/sih-pathfinding/blob/main/src/components/AdminView.tsx"
click node_analytics "https://github.com/smklabs/sih-pathfinding/blob/main/src/components/AdminView.tsx"
click node_shared_ui "https://github.com/smklabs/sih-pathfinding/blob/main/src/components/shared.tsx"
click node_domain_rules "https://github.com/smklabs/sih-pathfinding/blob/main/src/constants.ts"
click node_backend_client "https://github.com/smklabs/sih-pathfinding/blob/main/src/lib/supabase.ts"
click node_backend_store "https://github.com/smklabs/sih-pathfinding/blob/main/supabase/migrations/20260908070953_create_full_platform_schema.sql"
click node_pwa_worker "https://github.com/smklabs/sih-pathfinding/blob/main/public/sw.js"
click node_pwa_manifest "https://github.com/smklabs/sih-pathfinding/blob/main/public/manifest.json"

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_entry,node_app_shell toneBlue
class node_civilian_view,node_sos,node_shelter_guidance,node_household_recovery toneAmber
class node_coordinator,node_dispatch,node_regional_alerts,node_admin,node_shelter_capacity,node_analytics toneMint
class node_shared_ui,node_domain_rules,node_backend_client,node_backend_store,node_pwa_worker,node_pwa_manifest toneRose
class node_resident toneIndigo
```

## Components

### Application shell

- [React entry](https://github.com/smklabs/sih-pathfinding/blob/main/src/main.tsx): `src/main.tsx`
- [Role and theme shell](https://github.com/smklabs/sih-pathfinding/blob/main/src/App.tsx): `src/App.tsx`

### Resident response

- [Resident workflows](https://github.com/smklabs/sih-pathfinding/blob/main/src/components/CivilianView.tsx): `src/components/CivilianView.tsx`
- [Emergency SOS](https://github.com/smklabs/sih-pathfinding/blob/main/src/components/FloatingSOS.tsx): `src/components/FloatingSOS.tsx`
- [Shelter and guidance](https://github.com/smklabs/sih-pathfinding/blob/main/src/components/CivilianView.tsx): `src/components/CivilianView.tsx`
- [Household and recovery](https://github.com/smklabs/sih-pathfinding/blob/main/src/components/CivilianView.tsx): `src/components/CivilianView.tsx`

### Coordination operations

- [Incident coordination](https://github.com/smklabs/sih-pathfinding/blob/main/src/components/CoordinatorView.tsx): `src/components/CoordinatorView.tsx`
- [Relief dispatch tracking](https://github.com/smklabs/sih-pathfinding/blob/main/src/components/CoordinatorView.tsx): `src/components/CoordinatorView.tsx`
- [Regional safety alerts](https://github.com/smklabs/sih-pathfinding/blob/main/src/components/CoordinatorView.tsx): `src/components/CoordinatorView.tsx`
- [Administration](https://github.com/smklabs/sih-pathfinding/blob/main/src/components/AdminView.tsx): `src/components/AdminView.tsx`
- [Shelter capacity](https://github.com/smklabs/sih-pathfinding/blob/main/src/components/AdminView.tsx): `src/components/AdminView.tsx`
- [Operational analytics](https://github.com/smklabs/sih-pathfinding/blob/main/src/components/AdminView.tsx): `src/components/AdminView.tsx`

### Shared platform

- [Shared incident UI](https://github.com/smklabs/sih-pathfinding/blob/main/src/components/shared.tsx): `src/components/shared.tsx`
- [Emergency domain data](https://github.com/smklabs/sih-pathfinding/blob/main/src/constants.ts): `src/constants.ts`
- [Supabase client](https://github.com/smklabs/sih-pathfinding/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`
- [Platform database](https://github.com/smklabs/sih-pathfinding/blob/main/supabase/migrations/20260908070953_create_full_platform_schema.sql): `supabase/migrations/20260908070953_create_full_platform_schema.sql`
- [Offline service worker](https://github.com/smklabs/sih-pathfinding/blob/main/public/sw.js): `public/sw.js`
- [Install metadata](https://github.com/smklabs/sih-pathfinding/blob/main/public/manifest.json): `public/manifest.json`

### Other components

- **Resident / responder**

## Connections

- Resident / responder → React entry: opens app
- React entry → Role and theme shell: renders
- Role and theme shell → Resident workflows: selects role
- Role and theme shell → Incident coordination: selects role
- Role and theme shell → Administration: selects role
- Role and theme shell → Emergency SOS: renders
- Resident workflows → Emergency SOS: offers SOS
- Resident workflows → Shelter and guidance: renders tab
- Resident workflows → Household and recovery: renders tabs
- Incident coordination → Relief dispatch tracking: renders tab
- Incident coordination → Regional safety alerts: shows alerts
- Administration → Shelter capacity: renders tab
- Administration → Operational analytics: renders tab
- Resident workflows → Shared incident UI: renders
- Incident coordination → Shared incident UI: renders
- Administration → Shared incident UI: renders
- Shared incident UI → Emergency domain data: formats with
- Offline service worker → Install metadata: caches shell
- Resident / responder → Install metadata: installs app
