# snehagawande05/jalsaathi architecture

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

- Interactive diagram: https://gitdiagram.com/snehagawande05/jalsaathi
- Repository: https://github.com/snehagawande05/jalsaathi

## Overview

JalSaathi is a civic issue-reporting and maintenance-prioritization platform. Residents discover and filter map-based reports, submit a location and optional photo, track their reports, and upvote issues; administrators manage reports and status changes. The Express API routes requests to issue, ward, hotspot, and statistics services backed by Supabase and its photo storage. The README documents hotspots and priority lists, while unsampled route and page implementations limit confidence about their exact calls; those capability links are therefore not asserted beyond documented or indexed wiring.

Main entry points: [`server/src/app.js`](https://github.com/snehagawande05/jalsaathi/blob/main/server/src/app.js) (HTTP routes), [`client/lib/api.ts`](https://github.com/snehagawande05/jalsaathi/blob/main/client/lib/api.ts) (API client), [`server/src/services/issueService.js`](https://github.com/snehagawande05/jalsaathi/blob/main/server/src/services/issueService.js) (Issue lifecycle), [`client/app/report/page.tsx`](https://github.com/snehagawande05/jalsaathi/blob/main/client/app/report/page.tsx) (Issue reporting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Resident web app"]
  node_home["Issue discovery<br/>[page.tsx]"]
  node_report_form["Issue reporting<br/>[page.tsx]"]
  node_issue_detail["Issue tracking<br/>[page.tsx]"]
  node_my_reports["My reports<br/>[page.tsx]"]
  node_admin_console["Admin console<br/>[page.tsx]"]
  node_login["Sign-in page<br/>[page.tsx]"]
  node_map_view["Issue map<br/>[MapViewer.tsx]"]
  node_location_picker["Location picker"]
  node_auth_context["Auth state<br/>[authContext.tsx]"]
end

subgraph group_api["API and access"]
  node_api_client["API client<br/>[api.ts]"]
  node_express_app["HTTP routes<br/>[app.js]"]
  node_auth_middleware["Token verification<br/>[auth.js]"]
end

subgraph group_domain["Issue operations"]
  node_issue_routes["Issue endpoints<br/>[issues.js]"]
  node_admin_routes["Admin endpoints<br/>[admin.js]"]
  node_me_routes["Profile endpoints<br/>[me.js]"]
  node_issue_service["Issue lifecycle<br/>[issueService.js]"]
  node_photo_storage["Issue photos<br/>[storageService.js]"]
end

subgraph group_insights["Area insights"]
  node_ward_routes["Ward endpoints<br/>[wards.js]"]
  node_hotspot_routes["Hotspot endpoints<br/>[hotspots.js]"]
  node_stats_routes["Stats endpoints<br/>[stats.js]"]
  node_ward_service["Ward lookup<br/>[wardService.js]"]
  node_hotspot_service["Hotspot analysis<br/>[hotspotService.js]"]
  node_stats_service["Priority and stats<br/>[statsService.js]"]
end

subgraph group_data["Supabase data"]
  node_supabase_auth["Supabase Auth"]
  node_supabase_db[("Supabase database")]
  node_supabase_storage[("Supabase Storage")]
end

node_resident(("Residents"))
node_admin_user(("Maintenance admins"))

node_resident -->|"browses"| node_home
node_resident -->|"submits report"| node_report_form
node_resident -->|"tracks and votes"| node_issue_detail
node_admin_user -.->|"manages issues"| node_admin_console
node_home -->|"renders map"| node_map_view
node_login -->|"authenticates"| node_auth_context
node_auth_context -->|"signs in"| node_supabase_auth
node_auth_context -->|"fetches profile"| node_api_client
node_report_form -.->|"selects location"| node_location_picker
node_report_form -.->|"submits report"| node_api_client
node_issue_detail -.->|"loads issue"| node_api_client
node_my_reports -.->|"loads reports"| node_api_client
node_admin_console -.->|"manages issues"| node_api_client
node_api_client -->|"sends requests"| node_express_app
node_express_app -->|"mounts issues"| node_issue_routes
node_express_app -->|"mounts admin"| node_admin_routes
node_express_app -->|"mounts profile"| node_me_routes
node_express_app -->|"mounts wards"| node_ward_routes
node_express_app -->|"mounts hotspots"| node_hotspot_routes
node_issue_routes -.->|"delegates issues"| node_issue_service
node_admin_routes -.->|"delegates updates"| node_issue_service
node_me_routes -.->|"delegates reports"| node_issue_service
node_ward_routes -.->|"loads wards"| node_ward_service
node_hotspot_routes -.->|"loads hotspots"| node_hotspot_service
node_issue_service -->|"uploads photos"| node_photo_storage
node_issue_service -->|"reads and writes"| node_supabase_db
node_ward_service -->|"reads wards"| node_supabase_db
node_photo_storage -->|"stores photos"| node_supabase_storage
node_supabase_auth -.->|"provides tokens"| node_express_app
node_auth_middleware -->|"verifies token"| node_supabase_auth
node_auth_middleware -->|"reads profile"| node_supabase_db
node_stats_routes -.->|"loads statistics"| node_stats_service
node_stats_service -->|"queries metrics"| node_supabase_db
node_hotspot_service -.->|"queries hotspots"| node_supabase_db

click node_home "https://github.com/snehagawande05/jalsaathi/blob/main/client/app/page.tsx"
click node_report_form "https://github.com/snehagawande05/jalsaathi/blob/main/client/app/report/page.tsx"
click node_issue_detail "https://github.com/snehagawande05/jalsaathi/blob/main/client/app/issues/%5Bid%5D/page.tsx"
click node_my_reports "https://github.com/snehagawande05/jalsaathi/blob/main/client/app/my-reports/page.tsx"
click node_admin_console "https://github.com/snehagawande05/jalsaathi/blob/main/client/app/admin/page.tsx"
click node_login "https://github.com/snehagawande05/jalsaathi/blob/main/client/app/login/page.tsx"
click node_map_view "https://github.com/snehagawande05/jalsaathi/blob/main/client/components/map/MapViewer.tsx"
click node_location_picker "https://github.com/snehagawande05/jalsaathi/blob/main/client/components/map/LocationPickerMap.tsx"
click node_auth_context "https://github.com/snehagawande05/jalsaathi/blob/main/client/lib/authContext.tsx"
click node_api_client "https://github.com/snehagawande05/jalsaathi/blob/main/client/lib/api.ts"
click node_express_app "https://github.com/snehagawande05/jalsaathi/blob/main/server/src/app.js"
click node_auth_middleware "https://github.com/snehagawande05/jalsaathi/blob/main/server/src/middleware/auth.js"
click node_issue_routes "https://github.com/snehagawande05/jalsaathi/blob/main/server/src/routes/issues.js"
click node_admin_routes "https://github.com/snehagawande05/jalsaathi/blob/main/server/src/routes/admin.js"
click node_me_routes "https://github.com/snehagawande05/jalsaathi/blob/main/server/src/routes/me.js"
click node_issue_service "https://github.com/snehagawande05/jalsaathi/blob/main/server/src/services/issueService.js"
click node_photo_storage "https://github.com/snehagawande05/jalsaathi/blob/main/server/src/services/storageService.js"
click node_ward_routes "https://github.com/snehagawande05/jalsaathi/blob/main/server/src/routes/wards.js"
click node_hotspot_routes "https://github.com/snehagawande05/jalsaathi/blob/main/server/src/routes/hotspots.js"
click node_stats_routes "https://github.com/snehagawande05/jalsaathi/blob/main/server/src/routes/stats.js"
click node_ward_service "https://github.com/snehagawande05/jalsaathi/blob/main/server/src/services/wardService.js"
click node_hotspot_service "https://github.com/snehagawande05/jalsaathi/blob/main/server/src/services/hotspotService.js"
click node_stats_service "https://github.com/snehagawande05/jalsaathi/blob/main/server/src/services/statsService.js"

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_home,node_report_form,node_issue_detail,node_my_reports,node_admin_console,node_login,node_map_view,node_location_picker,node_auth_context toneBlue
class node_api_client,node_express_app,node_auth_middleware toneAmber
class node_issue_routes,node_admin_routes,node_me_routes,node_issue_service,node_photo_storage toneMint
class node_ward_routes,node_hotspot_routes,node_stats_routes,node_ward_service,node_hotspot_service,node_stats_service toneRose
class node_supabase_auth,node_supabase_db,node_supabase_storage,node_resident,node_admin_user toneIndigo
```

## Components

### Resident web app

- [Issue discovery](https://github.com/snehagawande05/jalsaathi/blob/main/client/app/page.tsx): `client/app/page.tsx`
- [Issue reporting](https://github.com/snehagawande05/jalsaathi/blob/main/client/app/report/page.tsx): `client/app/report/page.tsx`
- [Issue tracking](https://github.com/snehagawande05/jalsaathi/blob/main/client/app/issues/%5Bid%5D/page.tsx): `client/app/issues/[id]/page.tsx`
- [My reports](https://github.com/snehagawande05/jalsaathi/blob/main/client/app/my-reports/page.tsx): `client/app/my-reports/page.tsx`
- [Admin console](https://github.com/snehagawande05/jalsaathi/blob/main/client/app/admin/page.tsx): `client/app/admin/page.tsx`
- [Sign-in page](https://github.com/snehagawande05/jalsaathi/blob/main/client/app/login/page.tsx): `client/app/login/page.tsx`
- [Issue map](https://github.com/snehagawande05/jalsaathi/blob/main/client/components/map/MapViewer.tsx): `client/components/map/MapViewer.tsx`
- [Location picker](https://github.com/snehagawande05/jalsaathi/blob/main/client/components/map/LocationPickerMap.tsx): `client/components/map/LocationPickerMap.tsx`
- [Auth state](https://github.com/snehagawande05/jalsaathi/blob/main/client/lib/authContext.tsx): `client/lib/authContext.tsx`

### API and access

- [API client](https://github.com/snehagawande05/jalsaathi/blob/main/client/lib/api.ts): `client/lib/api.ts`
- [HTTP routes](https://github.com/snehagawande05/jalsaathi/blob/main/server/src/app.js): `server/src/app.js`
- [Token verification](https://github.com/snehagawande05/jalsaathi/blob/main/server/src/middleware/auth.js): `server/src/middleware/auth.js`

### Issue operations

- [Issue endpoints](https://github.com/snehagawande05/jalsaathi/blob/main/server/src/routes/issues.js): `server/src/routes/issues.js`
- [Admin endpoints](https://github.com/snehagawande05/jalsaathi/blob/main/server/src/routes/admin.js): `server/src/routes/admin.js`
- [Profile endpoints](https://github.com/snehagawande05/jalsaathi/blob/main/server/src/routes/me.js): `server/src/routes/me.js`
- [Issue lifecycle](https://github.com/snehagawande05/jalsaathi/blob/main/server/src/services/issueService.js): `server/src/services/issueService.js`
- [Issue photos](https://github.com/snehagawande05/jalsaathi/blob/main/server/src/services/storageService.js): `server/src/services/storageService.js`

### Area insights

- [Ward endpoints](https://github.com/snehagawande05/jalsaathi/blob/main/server/src/routes/wards.js): `server/src/routes/wards.js`
- [Hotspot endpoints](https://github.com/snehagawande05/jalsaathi/blob/main/server/src/routes/hotspots.js): `server/src/routes/hotspots.js`
- [Stats endpoints](https://github.com/snehagawande05/jalsaathi/blob/main/server/src/routes/stats.js): `server/src/routes/stats.js`
- [Ward lookup](https://github.com/snehagawande05/jalsaathi/blob/main/server/src/services/wardService.js): `server/src/services/wardService.js`
- [Hotspot analysis](https://github.com/snehagawande05/jalsaathi/blob/main/server/src/services/hotspotService.js): `server/src/services/hotspotService.js`
- [Priority and stats](https://github.com/snehagawande05/jalsaathi/blob/main/server/src/services/statsService.js): `server/src/services/statsService.js`

### Supabase data

- **Supabase Auth**
- **Supabase database**
- **Supabase Storage**

### Other components

- **Residents**
- **Maintenance admins**

## Connections

- Residents → Issue discovery: browses (evidence: `client/app/page.tsx`)
- Residents → Issue reporting: submits report
- Residents → Issue tracking: tracks and votes
- Maintenance admins → Admin console: manages issues (evidence: `README.md`)
- Issue discovery → Issue map: renders map (evidence: `client/app/page.tsx`)
- Sign-in page → Auth state: authenticates (evidence: `client/lib/authContext.tsx`)
- Auth state → Supabase Auth: signs in (evidence: `client/lib/authContext.tsx`)
- Auth state → API client: fetches profile (evidence: `client/lib/authContext.tsx`)
- Issue reporting → Location picker: selects location
- Issue reporting → API client: submits report
- Issue tracking → API client: loads issue
- My reports → API client: loads reports
- Admin console → API client: manages issues
- API client → HTTP routes: sends requests (evidence: `client/lib/api.ts`)
- HTTP routes → Issue endpoints: mounts issues (evidence: `server/src/app.js`)
- HTTP routes → Admin endpoints: mounts admin (evidence: `server/src/app.js`)
- HTTP routes → Profile endpoints: mounts profile (evidence: `server/src/app.js`)
- HTTP routes → Ward endpoints: mounts wards (evidence: `server/src/app.js`)
- HTTP routes → Hotspot endpoints: mounts hotspots (evidence: `server/src/app.js`)
- Issue endpoints → Issue lifecycle: delegates issues
- Admin endpoints → Issue lifecycle: delegates updates
- Profile endpoints → Issue lifecycle: delegates reports
- Ward endpoints → Ward lookup: loads wards
- Hotspot endpoints → Hotspot analysis: loads hotspots
- Issue lifecycle → Issue photos: uploads photos (evidence: `server/src/services/issueService.js`)
- Issue lifecycle → Supabase database: reads and writes (evidence: `server/src/services/issueService.js`)
- Ward lookup → Supabase database: reads wards (evidence: `server/src/services/wardService.js`)
- Issue photos → Supabase Storage: stores photos (evidence: `server/src/services/storageService.js`)
- Supabase Auth → HTTP routes: provides tokens
- Token verification → Supabase Auth: verifies token (evidence: `server/src/middleware/auth.js`)
- Token verification → Supabase database: reads profile (evidence: `server/src/middleware/auth.js`)
- Stats endpoints → Priority and stats: loads statistics
- Priority and stats → Supabase database: queries metrics (evidence: `server/src/services/statsService.js`)
- Hotspot analysis → Supabase database: queries hotspots
