# himmatmundhe07/samadhan_setu architecture

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

- Interactive diagram: https://gitdiagram.com/himmatmundhe07/samadhan_setu
- Repository: https://github.com/himmatmundhe07/samadhan_setu

## Overview

Societal Innovation Portal connects citizen reporting (web and Samadhan Setu mobile) to backend triage, institutional assignment, solution proposals and industry funding, with government oversight. The web app provides role-based portals; the mobile app emphasizes reporting, status tracking, notifications and voice/local-language access. Backend excerpts show report creation, queued AI processing and government analytics; other workflow stages are documented in the README and represented at their available module paths. Arrows reflect sampled calls or explicit route mounting; unsampled details are not inferred.

Main entry points: [`backend/src/app.js`](https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/app.js) (Express routes), [`backend/src/controllers/problem.controller.js`](https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/controllers/problem.controller.js) (Institution assignment), [`backend/src/controllers/government.controller.js`](https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/controllers/government.controller.js) (Government oversight), [`apps/web/src/App.tsx`](https://github.com/himmatmundhe07/samadhan_setu/blob/main/apps/web/src/App.tsx) (Role portals)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["User applications"]
  node_web["Role portals<br/>[App.tsx]"]
  node_mobile["Samadhan Setu<br/>[dashboard.tsx]"]
  node_webapi["Web API client<br/>[apiClient.ts]"]
  node_mobileapi["Mobile API<br/>[api.ts]"]
end

subgraph group_api["Backend API"]
  node_backend["Express routes<br/>[app.js]"]
  node_auth["Authentication<br/>[auth.controller.js]"]
end

subgraph group_workflow["Civic workflow"]
  node_problems["Problem reporting"]
  node_triage["AI triage worker<br/>[worker.js]"]
  node_assignment["Institution assignment"]
  node_universities["University directory"]
  node_projects["Solution projects"]
  node_industry["Industry partnerships<br/>[Partnerships.tsx]"]
  node_government["Government oversight"]
  node_voice["Voice services"]
end

subgraph group_state["Persistence and events"]
  node_problemstore[("Problem records<br/>[problem.model.js]")]
  node_projectstore[("Project records<br/>[project.model.js]")]
  node_userstore[("User records<br/>[user.model.js]")]
  node_queue["Classification queue<br/>[producer.js]"]
  node_socket["Realtime events<br/>[socket.js]"]
  node_database[("MongoDB<br/>[db.js]")]
end

subgraph group_integrations["External services"]
  node_ai["AI classification provider"]
  node_bhashini["Bhashini language services"]
end

node_citizen(("Citizen"))
node_industryactor(("Industry partner"))
node_universityactor(("University user"))

node_citizen -->|"reports or tracks"| node_web
node_citizen -->|"reports or tracks"| node_mobile
node_web -->|"requests"| node_webapi
node_mobile -->|"requests"| node_mobileapi
node_webapi -->|"calls API"| node_backend
node_mobileapi -->|"calls API"| node_backend
node_backend -->|"routes auth"| node_auth
node_backend -->|"routes reports"| node_problems
node_backend -->|"routes projects"| node_projects
node_backend -->|"routes directory"| node_universities
node_backend -->|"routes oversight"| node_government
node_backend -->|"routes voice"| node_voice
node_auth -->|"reads and writes"| node_userstore
node_problems -->|"creates and queries"| node_problemstore
node_problems -->|"enqueues classification"| node_queue
node_queue -->|"dispatches jobs"| node_triage
node_triage -.->|"classifies reports"| node_ai
node_triage -->|"updates via internal API"| node_problems
node_problems -->|"assigns institution"| node_assignment
node_assignment -->|"validates institution"| node_userstore
node_assignment -->|"updates assignment"| node_problemstore
node_assignment -->|"creates project"| node_projectstore
node_assignment -->|"emits assignment"| node_socket
node_universityactor -->|"manages proposals"| node_web
node_industryactor -->|"funds solutions"| node_web
node_industry -->|"requests partnership data"| node_webapi
node_projects -->|"reads and writes"| node_projectstore
node_universities -->|"stores institutions"| node_database
node_government -->|"aggregates reports"| node_problemstore
node_government -->|"aggregates projects"| node_projectstore
node_government -->|"aggregates users"| node_userstore
node_voice -.->|"transcribes or speaks"| node_bhashini
node_backend -->|"connects"| node_database

click node_web "https://github.com/himmatmundhe07/samadhan_setu/blob/main/apps/web/src/App.tsx"
click node_mobile "https://github.com/himmatmundhe07/samadhan_setu/blob/main/App/Samadhan_Setu_App/app/(tabs)/dashboard.tsx"
click node_webapi "https://github.com/himmatmundhe07/samadhan_setu/blob/main/apps/web/src/lib/apiClient.ts"
click node_mobileapi "https://github.com/himmatmundhe07/samadhan_setu/blob/main/App/Samadhan_Setu_App/src/services/api.ts"
click node_backend "https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/app.js"
click node_auth "https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/controllers/auth.controller.js"
click node_problems "https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/controllers/problem.controller.js"
click node_triage "https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/queue/worker.js"
click node_assignment "https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/controllers/problem.controller.js"
click node_universities "https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/controllers/university.controller.js"
click node_projects "https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/controllers/project.controller.js"
click node_industry "https://github.com/himmatmundhe07/samadhan_setu/blob/main/apps/web/src/pages/industry/Partnerships.tsx"
click node_government "https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/controllers/government.controller.js"
click node_voice "https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/controllers/voice.controller.js"
click node_problemstore "https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/models/problem.model.js"
click node_projectstore "https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/models/project.model.js"
click node_userstore "https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/models/user.model.js"
click node_queue "https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/queue/producer.js"
click node_socket "https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/config/socket.js"
click node_database "https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/config/db.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_web,node_mobile,node_webapi,node_mobileapi,node_universityactor toneBlue
class node_backend,node_auth toneAmber
class node_problems,node_triage,node_assignment,node_universities,node_projects,node_industry,node_government,node_voice toneMint
class node_problemstore,node_projectstore,node_userstore,node_queue,node_socket,node_database toneRose
class node_ai,node_bhashini,node_citizen,node_industryactor toneIndigo
```

## Components

### User applications

- [Role portals](https://github.com/himmatmundhe07/samadhan_setu/blob/main/apps/web/src/App.tsx): `apps/web/src/App.tsx`
- [Samadhan Setu](https://github.com/himmatmundhe07/samadhan_setu/blob/main/App/Samadhan_Setu_App/app/(tabs)/dashboard.tsx): `App/Samadhan_Setu_App/app/(tabs)/dashboard.tsx`
- [Web API client](https://github.com/himmatmundhe07/samadhan_setu/blob/main/apps/web/src/lib/apiClient.ts): `apps/web/src/lib/apiClient.ts`
- [Mobile API](https://github.com/himmatmundhe07/samadhan_setu/blob/main/App/Samadhan_Setu_App/src/services/api.ts): `App/Samadhan_Setu_App/src/services/api.ts`

### Backend API

- [Express routes](https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/app.js): `backend/src/app.js`
- [Authentication](https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/controllers/auth.controller.js): `backend/src/controllers/auth.controller.js`

### Civic workflow

- [Problem reporting](https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/controllers/problem.controller.js): `backend/src/controllers/problem.controller.js`
- [AI triage worker](https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/queue/worker.js): `backend/src/queue/worker.js`
- [Institution assignment](https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/controllers/problem.controller.js): `backend/src/controllers/problem.controller.js`
- [University directory](https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/controllers/university.controller.js): `backend/src/controllers/university.controller.js`
- [Solution projects](https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/controllers/project.controller.js): `backend/src/controllers/project.controller.js`
- [Industry partnerships](https://github.com/himmatmundhe07/samadhan_setu/blob/main/apps/web/src/pages/industry/Partnerships.tsx): `apps/web/src/pages/industry/Partnerships.tsx`
- [Government oversight](https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/controllers/government.controller.js): `backend/src/controllers/government.controller.js`
- [Voice services](https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/controllers/voice.controller.js): `backend/src/controllers/voice.controller.js`

### Persistence and events

- [Problem records](https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/models/problem.model.js): `backend/src/models/problem.model.js`
- [Project records](https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/models/project.model.js): `backend/src/models/project.model.js`
- [User records](https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/models/user.model.js): `backend/src/models/user.model.js`
- [Classification queue](https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/queue/producer.js): `backend/src/queue/producer.js`
- [Realtime events](https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/config/socket.js): `backend/src/config/socket.js`
- [MongoDB](https://github.com/himmatmundhe07/samadhan_setu/blob/main/backend/src/config/db.js): `backend/src/config/db.js`

### External services

- **AI classification provider**
- **Bhashini language services**

### Other components

- **Citizen**
- **Industry partner**
- **University user**

## Connections

- Citizen → Role portals: reports or tracks
- Citizen → Samadhan Setu: reports or tracks
- Role portals → Web API client: requests
- Samadhan Setu → Mobile API: requests
- Web API client → Express routes: calls API
- Mobile API → Express routes: calls API
- Express routes → Authentication: routes auth
- Express routes → Problem reporting: routes reports
- Express routes → Solution projects: routes projects
- Express routes → University directory: routes directory
- Express routes → Government oversight: routes oversight
- Express routes → Voice services: routes voice
- Authentication → User records: reads and writes
- Problem reporting → Problem records: creates and queries
- Problem reporting → Classification queue: enqueues classification
- Classification queue → AI triage worker: dispatches jobs
- AI triage worker → AI classification provider: classifies reports
- AI triage worker → Problem reporting: updates via internal API
- Problem reporting → Institution assignment: assigns institution
- Institution assignment → User records: validates institution
- Institution assignment → Problem records: updates assignment
- Institution assignment → Project records: creates project
- Institution assignment → Realtime events: emits assignment
- University user → Role portals: manages proposals
- Industry partner → Role portals: funds solutions
- Industry partnerships → Web API client: requests partnership data
- Solution projects → Project records: reads and writes
- University directory → MongoDB: stores institutions
- Government oversight → Problem records: aggregates reports
- Government oversight → Project records: aggregates projects
- Government oversight → User records: aggregates users
- Voice services → Bhashini language services: transcribes or speaks
- Express routes → MongoDB: connects
