# sheetalchaurasia13-max/civicproofai architecture

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

- Interactive diagram: https://gitdiagram.com/sheetalchaurasia13-max/civicproofai
- Repository: https://github.com/sheetalchaurasia13-max/civicproofai

## Overview

CivicProof AI is a civic-issue reporting and risk-awareness application. Citizens capture evidence, run image triage, and submit complaints; reports can be queued offline and later synced, then shown on a risk map. Separate API routes cover verification, image OCR, geocoding, places, chat, comparison, analysis, and safer routing. The excerpts support the complaint, map, local-AI, offline-sync, and routing links; other route behavior is represented from filenames only, so no unverified connections are asserted.

Main entry points: [`components/civic-proof-app.tsx`](https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/components/civic-proof-app.tsx) (CivicProof app), [`app/api/complaints/route.ts`](https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/api/complaints/route.ts) (Complaint API), [`app/api/route/route.ts`](https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/api/route/route.ts) (Safer routing), [`app/page.tsx`](https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/page.tsx) (Home entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Citizen experience"]
  node_root["Home entry<br/>[page.tsx]"]
  node_screen["Screen entry<br/>[page.tsx]"]
  node_app["CivicProof app"]
  node_riskmap["Risk map<br/>[civic-risk-map.tsx]"]
  node_button["Button UI<br/>[button.tsx]"]
end

subgraph group_reporting["Reports and routing"]
  node_offline["Offline queue<br/>[offline-queue.ts]"]
  node_complaints["Complaint API<br/>[route.ts]"]
  node_route["Safer routing<br/>[route.ts]"]
  node_complaintdb[("Complaints store")]
  node_routecache[("Route cache")]
end

subgraph group_services["AI and integrations"]
  node_imageai["Local image triage<br/>[local-civic-ai.ts]"]
  node_analyze["Analysis API<br/>[route.ts]"]
  node_chat["AI chat API<br/>[route.ts]"]
  node_compare["Comparison API<br/>[route.ts]"]
  node_verify["Verification API<br/>[route.ts]"]
  node_ocr["OCR API<br/>[route.ts]"]
  node_geocode["Geocoding API<br/>[route.ts]"]
  node_places["Places API<br/>[route.ts]"]
  node_storage["Image storage client<br/>[supabase.ts]"]
end

node_citizen(("Citizen"))
node_osrm["OSRM routing"]

node_citizen -->|"opens"| node_root
node_citizen -->|"opens"| node_screen
node_root -->|"renders"| node_app
node_screen -->|"renders"| node_app
node_app -->|"analyzes image"| node_imageai
node_app -->|"queues and syncs"| node_offline
node_offline -->|"posts reports"| node_complaints
node_riskmap -->|"fetches and upvotes"| node_complaints
node_complaints -->|"reads and writes"| node_complaintdb
node_complaints -->|"uploads evidence"| node_storage
node_storage -->|"stores images"| node_complaintdb
node_route -->|"reads hazards"| node_complaintdb
node_route -->|"requests routes"| node_osrm
node_route -->|"caches result"| node_routecache

click node_root "https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/page.tsx"
click node_screen "https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/%5Bscreen%5D/page.tsx"
click node_app "https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/components/civic-proof-app.tsx"
click node_riskmap "https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/components/civic-risk-map.tsx"
click node_button "https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/components/ui/button.tsx"
click node_offline "https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/lib/offline-queue.ts"
click node_complaints "https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/api/complaints/route.ts"
click node_route "https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/api/route/route.ts"
click node_imageai "https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/lib/local-civic-ai.ts"
click node_analyze "https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/api/analyze/route.ts"
click node_chat "https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/api/chat/route.ts"
click node_compare "https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/api/compare/route.ts"
click node_verify "https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/api/verify/route.ts"
click node_ocr "https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/api/ocr/route.ts"
click node_geocode "https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/api/geocode/route.ts"
click node_places "https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/api/places/route.ts"
click node_storage "https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/lib/supabase.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_root,node_screen,node_app,node_riskmap,node_button toneBlue
class node_offline,node_complaints,node_route,node_complaintdb,node_routecache toneAmber
class node_imageai,node_analyze,node_chat,node_compare,node_verify,node_ocr,node_geocode,node_places,node_storage toneMint
class node_citizen,node_osrm toneIndigo
```

## Components

### Citizen experience

- [Home entry](https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/page.tsx): `app/page.tsx`
- [Screen entry](https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/%5Bscreen%5D/page.tsx): `app/[screen]/page.tsx`
- [CivicProof app](https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/components/civic-proof-app.tsx): `components/civic-proof-app.tsx`
- [Risk map](https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/components/civic-risk-map.tsx): `components/civic-risk-map.tsx`
- [Button UI](https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/components/ui/button.tsx): `components/ui/button.tsx`

### Reports and routing

- [Offline queue](https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/lib/offline-queue.ts): `lib/offline-queue.ts`
- [Complaint API](https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/api/complaints/route.ts): `app/api/complaints/route.ts`
- [Safer routing](https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/api/route/route.ts): `app/api/route/route.ts`
- **Complaints store**
- **Route cache**

### AI and integrations

- [Local image triage](https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/lib/local-civic-ai.ts): `lib/local-civic-ai.ts`
- [Analysis API](https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/api/analyze/route.ts): `app/api/analyze/route.ts`
- [AI chat API](https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/api/chat/route.ts): `app/api/chat/route.ts`
- [Comparison API](https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/api/compare/route.ts): `app/api/compare/route.ts`
- [Verification API](https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/api/verify/route.ts): `app/api/verify/route.ts`
- [OCR API](https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/api/ocr/route.ts): `app/api/ocr/route.ts`
- [Geocoding API](https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/api/geocode/route.ts): `app/api/geocode/route.ts`
- [Places API](https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/app/api/places/route.ts): `app/api/places/route.ts`
- [Image storage client](https://github.com/sheetalchaurasia13-max/civicproofai/blob/main/lib/supabase.ts): `lib/supabase.ts`

### Other components

- **Citizen**
- **OSRM routing**

## Connections

- Citizen → Home entry: opens (evidence: `app/page.tsx`)
- Citizen → Screen entry: opens (evidence: `app/[screen]/page.tsx`)
- Home entry → CivicProof app: renders (evidence: `app/page.tsx`)
- Screen entry → CivicProof app: renders (evidence: `app/[screen]/page.tsx`)
- CivicProof app → Local image triage: analyzes image (evidence: `components/civic-proof-app.tsx`)
- CivicProof app → Offline queue: queues and syncs (evidence: `components/civic-proof-app.tsx`)
- Offline queue → Complaint API: posts reports (evidence: `lib/offline-queue.ts`)
- Risk map → Complaint API: fetches and upvotes (evidence: `components/civic-risk-map.tsx`)
- Complaint API → Complaints store: reads and writes (evidence: `app/api/complaints/route.ts`)
- Complaint API → Image storage client: uploads evidence (evidence: `app/api/complaints/route.ts`)
- Image storage client → Complaints store: stores images (evidence: `lib/supabase.ts`)
- Safer routing → Complaints store: reads hazards (evidence: `app/api/route/route.ts`)
- Safer routing → OSRM routing: requests routes (evidence: `app/api/route/route.ts`)
- Safer routing → Route cache: caches result (evidence: `app/api/route/route.ts`)
