# prateek-mohanty11/needsense architecture

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

- Interactive diagram: https://gitdiagram.com/prateek-mohanty11/needsense
- Repository: https://github.com/prateek-mohanty11/needsense

## Overview

NeedSense is a role-based community-issue and volunteer-coordination application. Citizens submit geolocated complaints; the data layer processes complaints into clusters and predictions, while administrators oversee reports, volunteers, assignments, and impact maps. Volunteers manage missions and track impact, with separate NGO collaboration and shared-volunteer-pool features. The sampled source shows browser-side IndexedDB persistence and context-driven workflows; the README is empty, so some feature connections are based only on source-index references.

Main entry points: [`contexts/data-context.tsx`](https://github.com/prateek-mohanty11/needsense/blob/main/contexts/data-context.tsx) (Application data), [`lib/db/index.ts`](https://github.com/prateek-mohanty11/needsense/blob/main/lib/db/index.ts) (IndexedDB setup), [`app/(citizen)/citizen/upload/page.tsx`](https://github.com/prateek-mohanty11/needsense/blob/main/app/(citizen)/citizen/upload/page.tsx) (Submit complaint), [`lib/db/collaboration.ts`](https://github.com/prateek-mohanty11/needsense/blob/main/lib/db/collaboration.ts) (Collaboration records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and reporting"]
  node_auth_pages["Sign-in and signup<br/>[page.tsx]"]
  node_complaint_submit["Submit complaint<br/>[page.tsx]"]
  node_citizen_reports["Complaint reports<br/>[page.tsx]"]
  node_citizen_home["Citizen dashboard<br/>[page.tsx]"]
end

subgraph group_operations["Issue operations"]
  node_processing["Complaint processing<br/>[process.ts]"]
  node_admin_dashboard["Admin oversight<br/>[page.tsx]"]
  node_admin_complaints["Complaint management<br/>[page.tsx]"]
  node_impact_map["Impact maps<br/>[page.tsx]"]
end

subgraph group_volunteers["Volunteer response"]
  node_volunteer_admin["Volunteer management<br/>[page.tsx]"]
  node_assignment_modal["Team assignment"]
  node_missions["Volunteer missions<br/>[page.tsx]"]
  node_volunteer_impact["Volunteer impact<br/>[page.tsx]"]
end

subgraph group_collaboration["NGO collaboration"]
  node_collab_tasks["Cross-NGO tasks"]
  node_collab[("Collaboration records<br/>[collaboration.ts]")]
  node_volunteer_pool["Shared volunteer pool<br/>[page.tsx]"]
end

subgraph group_platform["Application services"]
  node_auth["Authentication<br/>[auth-context.tsx]"]
  node_data["Application data<br/>[data-context.tsx]"]
  node_complaints_db[("Complaint records<br/>[complaints.ts]")]
  node_users_db[("User records<br/>[users.ts]")]
  node_missions_db[("Mission records<br/>[missions.ts]")]
  node_notifications_db[("Notifications<br/>[notifications.ts]")]
  node_cluster_db[("Cluster records<br/>[clusters.ts]")]
  node_storage[("IndexedDB setup<br/>[index.ts]")]
  node_digipin["DIGIPIN location codes<br/>[index.ts]"]
end

node_citizen(("Citizen"))

node_citizen -.->|"creates account"| node_auth_pages
node_citizen -.->|"reports issue"| node_complaint_submit
node_auth_pages -->|"authenticates"| node_auth
node_auth -->|"reads and updates"| node_users_db
node_complaint_submit -->|"submits report"| node_data
node_complaint_submit -->|"encodes location"| node_digipin
node_citizen_reports -->|"loads reports"| node_data
node_citizen_home -->|"loads overview"| node_data
node_data -->|"reads and writes"| node_complaints_db
node_data -->|"loads missions"| node_missions_db
node_data -->|"loads clusters"| node_cluster_db
node_data -->|"loads notifications"| node_notifications_db
node_data -->|"processes reports"| node_processing
node_complaints_db -->|"uses database"| node_storage
node_users_db -->|"uses database"| node_storage
node_missions_db -->|"uses database"| node_storage
node_admin_dashboard -->|"loads overview"| node_data
node_admin_complaints -->|"manages complaints"| node_data
node_admin_complaints -->|"opens assignment"| node_assignment_modal
node_impact_map -->|"loads map data"| node_data
node_volunteer_admin -->|"loads volunteers"| node_data
node_missions -->|"manages missions"| node_data
node_volunteer_impact -->|"loads impact"| node_data
node_collab_tasks -->|"reads collaboration"| node_collab
node_collab -->|"uses database"| node_storage
node_volunteer_pool -.->|"uses pool data"| node_collab

click node_auth_pages "https://github.com/prateek-mohanty11/needsense/blob/main/app/(auth)/signin/page.tsx"
click node_complaint_submit "https://github.com/prateek-mohanty11/needsense/blob/main/app/(citizen)/citizen/upload/page.tsx"
click node_citizen_reports "https://github.com/prateek-mohanty11/needsense/blob/main/app/(citizen)/citizen/reports/page.tsx"
click node_citizen_home "https://github.com/prateek-mohanty11/needsense/blob/main/app/(citizen)/citizen/dashboard/page.tsx"
click node_auth "https://github.com/prateek-mohanty11/needsense/blob/main/contexts/auth-context.tsx"
click node_data "https://github.com/prateek-mohanty11/needsense/blob/main/contexts/data-context.tsx"
click node_complaints_db "https://github.com/prateek-mohanty11/needsense/blob/main/lib/db/complaints.ts"
click node_users_db "https://github.com/prateek-mohanty11/needsense/blob/main/lib/db/users.ts"
click node_missions_db "https://github.com/prateek-mohanty11/needsense/blob/main/lib/db/missions.ts"
click node_notifications_db "https://github.com/prateek-mohanty11/needsense/blob/main/lib/db/notifications.ts"
click node_cluster_db "https://github.com/prateek-mohanty11/needsense/blob/main/lib/db/clusters.ts"
click node_storage "https://github.com/prateek-mohanty11/needsense/blob/main/lib/db/index.ts"
click node_processing "https://github.com/prateek-mohanty11/needsense/blob/main/lib/api/process.ts"
click node_admin_dashboard "https://github.com/prateek-mohanty11/needsense/blob/main/app/(admin)/admin/dashboard/page.tsx"
click node_admin_complaints "https://github.com/prateek-mohanty11/needsense/blob/main/app/(admin)/admin/complaints/page.tsx"
click node_impact_map "https://github.com/prateek-mohanty11/needsense/blob/main/app/(admin)/admin/impact-map/page.tsx"
click node_volunteer_admin "https://github.com/prateek-mohanty11/needsense/blob/main/app/(admin)/admin/volunteers/page.tsx"
click node_assignment_modal "https://github.com/prateek-mohanty11/needsense/blob/main/components/admin/MultiVolunteerAssignmentModal.tsx"
click node_missions "https://github.com/prateek-mohanty11/needsense/blob/main/app/(volunteer)/volunteer/missions/page.tsx"
click node_volunteer_impact "https://github.com/prateek-mohanty11/needsense/blob/main/app/(volunteer)/volunteer/impact-dashboard/page.tsx"
click node_collab_tasks "https://github.com/prateek-mohanty11/needsense/blob/main/components/admin/collaboration/CrossNGOTasksTab.tsx"
click node_collab "https://github.com/prateek-mohanty11/needsense/blob/main/lib/db/collaboration.ts"
click node_volunteer_pool "https://github.com/prateek-mohanty11/needsense/blob/main/app/(volunteer)/volunteer/volunteer-pool/page.tsx"
click node_digipin "https://github.com/prateek-mohanty11/needsense/blob/main/lib/digipin/index.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_auth_pages,node_complaint_submit,node_citizen_reports,node_citizen_home toneBlue
class node_processing,node_admin_dashboard,node_admin_complaints,node_impact_map toneAmber
class node_volunteer_admin,node_assignment_modal,node_missions,node_volunteer_impact toneMint
class node_collab_tasks,node_collab,node_volunteer_pool toneRose
class node_auth,node_data,node_complaints_db,node_users_db,node_missions_db,node_notifications_db,node_cluster_db,node_storage,node_digipin,node_citizen toneIndigo
```

## Components

### Access and reporting

- [Sign-in and signup](https://github.com/prateek-mohanty11/needsense/blob/main/app/(auth)/signin/page.tsx): `app/(auth)/signin/page.tsx`
- [Submit complaint](https://github.com/prateek-mohanty11/needsense/blob/main/app/(citizen)/citizen/upload/page.tsx): `app/(citizen)/citizen/upload/page.tsx`
- [Complaint reports](https://github.com/prateek-mohanty11/needsense/blob/main/app/(citizen)/citizen/reports/page.tsx): `app/(citizen)/citizen/reports/page.tsx`
- [Citizen dashboard](https://github.com/prateek-mohanty11/needsense/blob/main/app/(citizen)/citizen/dashboard/page.tsx): `app/(citizen)/citizen/dashboard/page.tsx`

### Issue operations

- [Complaint processing](https://github.com/prateek-mohanty11/needsense/blob/main/lib/api/process.ts): `lib/api/process.ts`
- [Admin oversight](https://github.com/prateek-mohanty11/needsense/blob/main/app/(admin)/admin/dashboard/page.tsx): `app/(admin)/admin/dashboard/page.tsx`
- [Complaint management](https://github.com/prateek-mohanty11/needsense/blob/main/app/(admin)/admin/complaints/page.tsx): `app/(admin)/admin/complaints/page.tsx`
- [Impact maps](https://github.com/prateek-mohanty11/needsense/blob/main/app/(admin)/admin/impact-map/page.tsx): `app/(admin)/admin/impact-map/page.tsx`

### Volunteer response

- [Volunteer management](https://github.com/prateek-mohanty11/needsense/blob/main/app/(admin)/admin/volunteers/page.tsx): `app/(admin)/admin/volunteers/page.tsx`
- [Team assignment](https://github.com/prateek-mohanty11/needsense/blob/main/components/admin/MultiVolunteerAssignmentModal.tsx): `components/admin/MultiVolunteerAssignmentModal.tsx`
- [Volunteer missions](https://github.com/prateek-mohanty11/needsense/blob/main/app/(volunteer)/volunteer/missions/page.tsx): `app/(volunteer)/volunteer/missions/page.tsx`
- [Volunteer impact](https://github.com/prateek-mohanty11/needsense/blob/main/app/(volunteer)/volunteer/impact-dashboard/page.tsx): `app/(volunteer)/volunteer/impact-dashboard/page.tsx`

### NGO collaboration

- [Cross-NGO tasks](https://github.com/prateek-mohanty11/needsense/blob/main/components/admin/collaboration/CrossNGOTasksTab.tsx): `components/admin/collaboration/CrossNGOTasksTab.tsx`
- [Collaboration records](https://github.com/prateek-mohanty11/needsense/blob/main/lib/db/collaboration.ts): `lib/db/collaboration.ts`
- [Shared volunteer pool](https://github.com/prateek-mohanty11/needsense/blob/main/app/(volunteer)/volunteer/volunteer-pool/page.tsx): `app/(volunteer)/volunteer/volunteer-pool/page.tsx`

### Application services

- [Authentication](https://github.com/prateek-mohanty11/needsense/blob/main/contexts/auth-context.tsx): `contexts/auth-context.tsx`
- [Application data](https://github.com/prateek-mohanty11/needsense/blob/main/contexts/data-context.tsx): `contexts/data-context.tsx`
- [Complaint records](https://github.com/prateek-mohanty11/needsense/blob/main/lib/db/complaints.ts): `lib/db/complaints.ts`
- [User records](https://github.com/prateek-mohanty11/needsense/blob/main/lib/db/users.ts): `lib/db/users.ts`
- [Mission records](https://github.com/prateek-mohanty11/needsense/blob/main/lib/db/missions.ts): `lib/db/missions.ts`
- [Notifications](https://github.com/prateek-mohanty11/needsense/blob/main/lib/db/notifications.ts): `lib/db/notifications.ts`
- [Cluster records](https://github.com/prateek-mohanty11/needsense/blob/main/lib/db/clusters.ts): `lib/db/clusters.ts`
- [IndexedDB setup](https://github.com/prateek-mohanty11/needsense/blob/main/lib/db/index.ts): `lib/db/index.ts`
- [DIGIPIN location codes](https://github.com/prateek-mohanty11/needsense/blob/main/lib/digipin/index.ts): `lib/digipin/index.ts`

### Other components

- **Citizen**

## Connections

- Citizen → Sign-in and signup: creates account
- Citizen → Submit complaint: reports issue
- Sign-in and signup → Authentication: authenticates (evidence: `app/(auth)/signin/page.tsx`)
- Authentication → User records: reads and updates (evidence: `contexts/auth-context.tsx`)
- Submit complaint → Application data: submits report (evidence: `app/(citizen)/citizen/upload/page.tsx`)
- Submit complaint → DIGIPIN location codes: encodes location (evidence: `app/(citizen)/citizen/upload/page.tsx`)
- Complaint reports → Application data: loads reports (evidence: `app/(citizen)/citizen/reports/page.tsx`)
- Citizen dashboard → Application data: loads overview (evidence: `app/(citizen)/citizen/dashboard/page.tsx`)
- Application data → Complaint records: reads and writes (evidence: `contexts/data-context.tsx`)
- Application data → Mission records: loads missions (evidence: `contexts/data-context.tsx`)
- Application data → Cluster records: loads clusters (evidence: `contexts/data-context.tsx`)
- Application data → Notifications: loads notifications (evidence: `contexts/data-context.tsx`)
- Application data → Complaint processing: processes reports (evidence: `contexts/data-context.tsx`)
- Complaint records → IndexedDB setup: uses database (evidence: `lib/db/index.ts`)
- User records → IndexedDB setup: uses database (evidence: `lib/db/index.ts`)
- Mission records → IndexedDB setup: uses database (evidence: `lib/db/index.ts`)
- Admin oversight → Application data: loads overview (evidence: `app/(admin)/admin/dashboard/page.tsx`)
- Complaint management → Application data: manages complaints (evidence: `app/(admin)/admin/complaints/page.tsx`)
- Complaint management → Team assignment: opens assignment (evidence: `app/(admin)/admin/complaints/page.tsx`)
- Impact maps → Application data: loads map data (evidence: `app/(admin)/admin/impact-map/page.tsx`)
- Volunteer management → Application data: loads volunteers (evidence: `app/(admin)/admin/volunteers/page.tsx`)
- Volunteer missions → Application data: manages missions (evidence: `app/(volunteer)/volunteer/missions/page.tsx`)
- Volunteer impact → Application data: loads impact (evidence: `app/(volunteer)/volunteer/impact-dashboard/page.tsx`)
- Cross-NGO tasks → Collaboration records: reads collaboration (evidence: `components/admin/collaboration/CrossNGOTasksTab.tsx`)
- Collaboration records → IndexedDB setup: uses database (evidence: `lib/db/index.ts`)
- Shared volunteer pool → Collaboration records: uses pool data
