# atharvaerror/ycce-repo- architecture

> Architecture diagram of the GitHub repository atharvaerror/ycce-repo-, 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/atharvaerror/ycce-repo-
- Repository: https://github.com/atharvaerror/ycce-repo-

## Overview

JalDrishti is a map-first community water and sanitation tracker. Residents submit reports through the web form or Telegram; the service triages and deduplicates them, stores issues, and derives hotspots and explainable repair priorities. Engineers act on the ranked queue with geofenced proof of repair, while citizens can confirm or reopen fixes. The product also gathers daily water-supply pulses and presents public maps, scorecards, and issue timelines. Relationships shown are limited to the README and source excerpts/index references; uninspected route and page wiring is not inferred.

Main entry points: [`src/lib/service.ts`](https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/service.ts) (Issue service), [`src/lib/client.ts`](https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/client.ts) (Web data client), [`src/app/engineer/engineer-console.tsx`](https://github.com/atharvaerror/ycce-repo-/blob/main/src/app/engineer/engineer-console.tsx) (Fix-next console), [`src/lib/store.ts`](https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/store.ts) (Issue and pulse store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Report intake"]
  node_report_form["Report form<br/>[report-form.tsx]"]
  node_offline_queue["Offline queue<br/>[outbox.ts]"]
  node_telegram_bot["Telegram bot<br/>[telegram.ts]"]
  node_api_issues["Issue API<br/>[route.ts]"]
  node_api_issue_detail["Issue action API<br/>[route.ts]"]
end

subgraph group_operations["Issue operations"]
  node_service["Issue service<br/>[service.ts]"]
  node_triage["Report triage<br/>[triage.ts]"]
  node_geo["Geospatial rules<br/>[geo.ts]"]
  node_places["Place and asset data<br/>[places.ts]"]
  node_priority["Priority scoring<br/>[priority.ts]"]
  node_hotspots["Hotspot analysis<br/>[hotspots.ts]"]
  node_engineer_console["Fix-next console"]
  node_issue_detail["Issue timeline<br/>[issue-detail.tsx]"]
end

subgraph group_insights["Maps and insights"]
  node_pulse_card["Supply pulse<br/>[pulse-card.tsx]"]
  node_pulse_api["Pulse API<br/>[route.ts]"]
  node_map["Interactive map<br/>[map-view.tsx]"]
  node_dashboard["Zone dashboard<br/>[dashboard.tsx]"]
  node_stats_api["Stats API<br/>[route.ts]"]
  node_hotspots_api["Hotspots API<br/>[route.ts]"]
end

subgraph group_experience["Web experience"]
  node_client["Web data client<br/>[client.ts]"]
  node_home["Public home<br/>[home-view.tsx]"]
end

subgraph group_persistence["Persistence and integrations"]
  node_store[("Issue and pulse store<br/>[store.ts]")]
  node_seed["Demo issue seed<br/>[seed.ts]"]
end

node_resident(("Resident"))
node_engineer(("Engineer"))
node_telegram_api["Telegram API"]
node_supabase[("Supabase")]
node_local_json[("Local JSON store")]

node_resident -->|"submits report"| node_report_form
node_report_form -->|"queues offline"| node_offline_queue
node_report_form -->|"posts report"| node_api_issues
node_resident -->|"reports by bot"| node_telegram_bot
node_telegram_bot -->|"sends bot messages"| node_telegram_api
node_telegram_bot -->|"creates and acts"| node_service
node_api_issues -->|"routes requests"| node_service
node_service -->|"triages report"| node_triage
node_service -->|"checks distances"| node_geo
node_service -->|"uses place data"| node_places
node_service -->|"scores issues"| node_priority
node_service -->|"computes hotspots"| node_hotspots
node_service -->|"reads and writes"| node_store
node_service -->|"notifies resolution"| node_telegram_bot
node_engineer -->|"reviews queue"| node_engineer_console
node_engineer_console -->|"loads issue data"| node_client
node_engineer_console -.->|"starts and resolves"| node_api_issue_detail
node_api_issue_detail -->|"dispatches actions"| node_service
node_resident -->|"tracks issue"| node_issue_detail
node_issue_detail -->|"loads issue actions"| node_client
node_client -->|"fetches issues"| node_api_issues
node_client -->|"sends actions"| node_api_issue_detail
node_resident -->|"taps supply status"| node_pulse_card
node_pulse_card -->|"posts pulse"| node_pulse_api
node_pulse_api -.->|"records pulse"| node_service
node_engineer_console -.->|"views supply alerts"| node_pulse_api
node_resident -->|"explores reports"| node_map
node_map -->|"loads map data"| node_client
node_client -->|"fetches hotspots"| node_hotspots_api
node_hotspots_api -->|"requests hotspots"| node_service
node_resident -->|"views scorecards"| node_dashboard
node_dashboard -->|"loads statistics"| node_client
node_client -->|"fetches stats"| node_stats_api
node_stats_api -->|"requests stats"| node_service
node_resident -->|"views live overview"| node_home
node_home -->|"loads live data"| node_client
node_home -->|"renders pulse"| node_pulse_card
node_store -->|"initializes demo data"| node_seed
node_store -->|"uses when configured"| node_supabase
node_store -->|"persists fallback"| node_local_json

click node_report_form "https://github.com/atharvaerror/ycce-repo-/blob/main/src/app/report/report-form.tsx"
click node_offline_queue "https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/outbox.ts"
click node_telegram_bot "https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/telegram.ts"
click node_api_issues "https://github.com/atharvaerror/ycce-repo-/blob/main/src/app/api/issues/route.ts"
click node_service "https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/service.ts"
click node_triage "https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/triage.ts"
click node_geo "https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/geo.ts"
click node_places "https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/places.ts"
click node_priority "https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/priority.ts"
click node_hotspots "https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/hotspots.ts"
click node_pulse_card "https://github.com/atharvaerror/ycce-repo-/blob/main/src/components/pulse-card.tsx"
click node_pulse_api "https://github.com/atharvaerror/ycce-repo-/blob/main/src/app/api/pulse/route.ts"
click node_map "https://github.com/atharvaerror/ycce-repo-/blob/main/src/app/map/map-view.tsx"
click node_dashboard "https://github.com/atharvaerror/ycce-repo-/blob/main/src/app/dashboard/dashboard.tsx"
click node_engineer_console "https://github.com/atharvaerror/ycce-repo-/blob/main/src/app/engineer/engineer-console.tsx"
click node_issue_detail "https://github.com/atharvaerror/ycce-repo-/blob/main/src/app/issues/%5Bid%5D/issue-detail.tsx"
click node_api_issue_detail "https://github.com/atharvaerror/ycce-repo-/blob/main/src/app/api/issues/%5Bid%5D/route.ts"
click node_client "https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/client.ts"
click node_stats_api "https://github.com/atharvaerror/ycce-repo-/blob/main/src/app/api/stats/route.ts"
click node_hotspots_api "https://github.com/atharvaerror/ycce-repo-/blob/main/src/app/api/hotspots/route.ts"
click node_store "https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/store.ts"
click node_seed "https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/seed.ts"
click node_home "https://github.com/atharvaerror/ycce-repo-/blob/main/src/app/home-view.tsx"

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_report_form,node_offline_queue,node_telegram_bot,node_api_issues,node_api_issue_detail toneBlue
class node_service,node_triage,node_geo,node_places,node_priority,node_hotspots,node_engineer_console,node_issue_detail,node_supabase,node_local_json toneAmber
class node_pulse_card,node_pulse_api,node_map,node_dashboard,node_stats_api,node_hotspots_api,node_telegram_api toneMint
class node_client,node_home toneRose
class node_store,node_seed,node_resident,node_engineer toneIndigo
```

## Components

### Report intake

- [Report form](https://github.com/atharvaerror/ycce-repo-/blob/main/src/app/report/report-form.tsx): `src/app/report/report-form.tsx`
- [Offline queue](https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/outbox.ts): `src/lib/outbox.ts`
- [Telegram bot](https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/telegram.ts): `src/lib/telegram.ts`
- [Issue API](https://github.com/atharvaerror/ycce-repo-/blob/main/src/app/api/issues/route.ts): `src/app/api/issues/route.ts`
- [Issue action API](https://github.com/atharvaerror/ycce-repo-/blob/main/src/app/api/issues/%5Bid%5D/route.ts): `src/app/api/issues/[id]/route.ts`

### Issue operations

- [Issue service](https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/service.ts): `src/lib/service.ts`
- [Report triage](https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/triage.ts): `src/lib/triage.ts`
- [Geospatial rules](https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/geo.ts): `src/lib/geo.ts`
- [Place and asset data](https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/places.ts): `src/lib/places.ts`
- [Priority scoring](https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/priority.ts): `src/lib/priority.ts`
- [Hotspot analysis](https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/hotspots.ts): `src/lib/hotspots.ts`
- [Fix-next console](https://github.com/atharvaerror/ycce-repo-/blob/main/src/app/engineer/engineer-console.tsx): `src/app/engineer/engineer-console.tsx`
- [Issue timeline](https://github.com/atharvaerror/ycce-repo-/blob/main/src/app/issues/%5Bid%5D/issue-detail.tsx): `src/app/issues/[id]/issue-detail.tsx`

### Maps and insights

- [Supply pulse](https://github.com/atharvaerror/ycce-repo-/blob/main/src/components/pulse-card.tsx): `src/components/pulse-card.tsx`
- [Pulse API](https://github.com/atharvaerror/ycce-repo-/blob/main/src/app/api/pulse/route.ts): `src/app/api/pulse/route.ts`
- [Interactive map](https://github.com/atharvaerror/ycce-repo-/blob/main/src/app/map/map-view.tsx): `src/app/map/map-view.tsx`
- [Zone dashboard](https://github.com/atharvaerror/ycce-repo-/blob/main/src/app/dashboard/dashboard.tsx): `src/app/dashboard/dashboard.tsx`
- [Stats API](https://github.com/atharvaerror/ycce-repo-/blob/main/src/app/api/stats/route.ts): `src/app/api/stats/route.ts`
- [Hotspots API](https://github.com/atharvaerror/ycce-repo-/blob/main/src/app/api/hotspots/route.ts): `src/app/api/hotspots/route.ts`

### Web experience

- [Web data client](https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/client.ts): `src/lib/client.ts`
- [Public home](https://github.com/atharvaerror/ycce-repo-/blob/main/src/app/home-view.tsx): `src/app/home-view.tsx`

### Persistence and integrations

- [Issue and pulse store](https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/store.ts): `src/lib/store.ts`
- [Demo issue seed](https://github.com/atharvaerror/ycce-repo-/blob/main/src/lib/seed.ts): `src/lib/seed.ts`

### Other components

- **Resident**
- **Engineer**
- **Telegram API**
- **Supabase**
- **Local JSON store**

## Connections

- Resident → Report form: submits report
- Report form → Offline queue: queues offline (evidence: `src/app/report/report-form.tsx`)
- Report form → Issue API: posts report (evidence: `src/app/report/report-form.tsx`)
- Resident → Telegram bot: reports by bot
- Telegram bot → Telegram API: sends bot messages (evidence: `src/lib/telegram.ts`)
- Telegram bot → Issue service: creates and acts (evidence: `src/lib/telegram.ts`)
- Issue API → Issue service: routes requests (evidence: `src/app/api/issues/route.ts`)
- Issue service → Report triage: triages report (evidence: `src/lib/service.ts`)
- Issue service → Geospatial rules: checks distances (evidence: `src/lib/service.ts`)
- Issue service → Place and asset data: uses place data (evidence: `src/lib/service.ts`)
- Issue service → Priority scoring: scores issues (evidence: `src/lib/service.ts`)
- Issue service → Hotspot analysis: computes hotspots (evidence: `src/lib/service.ts`)
- Issue service → Issue and pulse store: reads and writes (evidence: `src/lib/service.ts`)
- Issue service → Telegram bot: notifies resolution (evidence: `src/lib/service.ts`)
- Engineer → Fix-next console: reviews queue
- Fix-next console → Web data client: loads issue data (evidence: `src/app/engineer/engineer-console.tsx`)
- Fix-next console → Issue action API: starts and resolves
- Issue action API → Issue service: dispatches actions (evidence: `src/app/api/issues/[id]/route.ts`)
- Resident → Issue timeline: tracks issue
- Issue timeline → Web data client: loads issue actions (evidence: `src/app/issues/[id]/issue-detail.tsx`)
- Web data client → Issue API: fetches issues (evidence: `src/lib/client.ts`)
- Web data client → Issue action API: sends actions (evidence: `src/lib/client.ts`)
- Resident → Supply pulse: taps supply status
- Supply pulse → Pulse API: posts pulse (evidence: `src/components/pulse-card.tsx`)
- Pulse API → Issue service: records pulse (evidence: `src/app/api/pulse/route.ts`)
- Fix-next console → Pulse API: views supply alerts
- Resident → Interactive map: explores reports
- Interactive map → Web data client: loads map data (evidence: `src/app/map/map-view.tsx`)
- Web data client → Hotspots API: fetches hotspots (evidence: `src/lib/client.ts`)
- Hotspots API → Issue service: requests hotspots (evidence: `src/app/api/hotspots/route.ts`)
- Resident → Zone dashboard: views scorecards
- Zone dashboard → Web data client: loads statistics (evidence: `src/app/dashboard/dashboard.tsx`)
- Web data client → Stats API: fetches stats (evidence: `src/lib/client.ts`)
- Stats API → Issue service: requests stats (evidence: `src/app/api/stats/route.ts`)
- Resident → Public home: views live overview
- Public home → Web data client: loads live data (evidence: `src/app/home-view.tsx`)
- Public home → Supply pulse: renders pulse (evidence: `src/app/home-view.tsx`)
- Issue and pulse store → Demo issue seed: initializes demo data (evidence: `src/lib/store.ts`)
- Issue and pulse store → Supabase: uses when configured (evidence: `src/lib/store.ts`)
- Issue and pulse store → Local JSON store: persists fallback (evidence: `src/lib/store.ts`)
