# mundlapudimuneendra-ops/jansahay-ai architecture

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

- Interactive diagram: https://gitdiagram.com/mundlapudimuneendra-ops/jansahay-ai
- Repository: https://github.com/mundlapudimuneendra-ops/jansahay-ai

## Overview

JANSAHAY is a citizen-assistance guide for discovering government documents and understanding how to prepare and apply; it does not issue certificates. The principal journey runs from catalogue/search through document details, requirements, application steps, and application-channel guidance. Separate branches provide multilingual access, saved-document accounts, and a bilingual/trilingual AI assistant. Relationships are based on the README journey and capabilities, plus the supplied source excerpts and SOURCE INDEX; unsampled implementation details are represented conservatively.

Main entry points: [`frontend/src/App.tsx`](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/App.tsx) (App routing), [`frontend/src/data/documentsData.ts`](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/data/documentsData.ts) (Document dossiers), [`frontend/src/services/jansahayAiService.ts`](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/services/jansahayAiService.ts) (Local AI guidance), [`frontend/src/pages/WhereToApplyPage.tsx`](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/pages/WhereToApplyPage.tsx) (Apply locations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["Document discovery"]
  node_catalogue["Document catalogue<br/>[DocumentsPage.tsx]"]
  node_search["Document search<br/>[documentSearch.ts]"]
  node_search_results["Search results"]
  node_document_data["Document dossiers<br/>[documentsData.ts]"]
end

subgraph group_guidance["Application guidance"]
  node_document_detail["Document overview"]
  node_requirements["Requirements checklist"]
  node_application_guide["Application timeline"]
  node_apply_channels["Apply locations"]
  node_center_data["Civic center data<br/>[civicCenters.ts]"]
end

subgraph group_citizen["Citizen experience"]
  node_app["App routing<br/>[App.tsx]"]
  node_translations["Language context<br/>[useLanguage.tsx]"]
  node_translation_data["Localized content"]
  node_interface_translations["Interface translations<br/>[translations.ts]"]
  node_auth_context["Citizen session<br/>[useAuth.tsx]"]
  node_assistant_ui["AI assistant"]
end

subgraph group_services["Application services"]
  node_auth_api["Frontend auth API<br/>[authService.ts]"]
  node_backend_auth_routes["Auth routes<br/>[authRoutes.ts]"]
  node_backend_auth_controller["Auth controller<br/>[authController.ts]"]
  node_auth_logic["Auth service<br/>[authService.ts]"]
  node_user_store[("User database<br/>[database.ts]")]
  node_assistant_logic["Local AI guidance"]
  node_ai_routes["AI routes<br/>[aiRoutes.ts]"]
  node_ai_controller["AI controller<br/>[aiController.ts]"]
  node_gemini["Gemini integration<br/>[geminiService.ts]"]
end

node_citizen_actor(("Citizen"))

node_citizen_actor -->|"opens"| node_app
node_app -->|"routes to"| node_catalogue
node_app -->|"routes to"| node_search_results
node_app -->|"routes to"| node_document_detail
node_app -->|"routes to"| node_requirements
node_app -->|"routes to"| node_application_guide
node_app -->|"routes to"| node_apply_channels
node_catalogue -->|"reads"| node_document_data
node_search_results -->|"queries"| node_search
node_search -->|"searches"| node_document_data
node_document_detail -->|"reads"| node_document_data
node_requirements -->|"uses dossier"| node_document_data
node_application_guide -->|"reads"| node_document_data
node_apply_channels -->|"reads"| node_document_data
node_apply_channels -.->|"uses locator data"| node_center_data
node_app -->|"provides language"| node_translations
node_translations -->|"localizes documents"| node_translation_data
node_translations -->|"loads strings"| node_interface_translations
node_app -->|"provides session"| node_auth_context
node_auth_context -->|"calls"| node_auth_api
node_auth_api -->|"HTTP requests"| node_backend_auth_routes
node_backend_auth_routes -->|"dispatches"| node_backend_auth_controller
node_backend_auth_controller -->|"delegates"| node_auth_logic
node_auth_logic -->|"reads and writes"| node_user_store
node_app -->|"renders"| node_assistant_ui
node_assistant_ui -->|"requests guidance"| node_assistant_logic
node_assistant_logic -->|"normalizes queries"| node_search
node_assistant_logic -->|"grounds answers"| node_document_data
node_assistant_logic -->|"localizes answers"| node_translation_data
node_assistant_logic -.->|"optional API"| node_ai_routes
node_ai_routes -->|"dispatches"| node_ai_controller
node_ai_controller -->|"generates response"| node_gemini

click node_app "https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/App.tsx"
click node_catalogue "https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/pages/DocumentsPage.tsx"
click node_search "https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/services/documentSearch.ts"
click node_search_results "https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/pages/SearchResultsPage.tsx"
click node_document_data "https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/data/documentsData.ts"
click node_document_detail "https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/pages/DocumentDetailPage.tsx"
click node_requirements "https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/pages/RequirementsPage.tsx"
click node_application_guide "https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/pages/ApplicationGuidePage.tsx"
click node_apply_channels "https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/pages/WhereToApplyPage.tsx"
click node_center_data "https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/data/civicCenters.ts"
click node_translations "https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/hooks/useLanguage.tsx"
click node_translation_data "https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/data/documentTranslations.ts"
click node_interface_translations "https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/data/translations.ts"
click node_auth_context "https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/hooks/useAuth.tsx"
click node_auth_api "https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/services/authService.ts"
click node_backend_auth_routes "https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/backend/src/routes/authRoutes.ts"
click node_backend_auth_controller "https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/backend/src/controllers/authController.ts"
click node_auth_logic "https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/backend/src/services/authService.ts"
click node_user_store "https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/backend/src/db/database.ts"
click node_assistant_ui "https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/components/ai/JansahayAiAssistant.tsx"
click node_assistant_logic "https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/services/jansahayAiService.ts"
click node_ai_routes "https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/backend/src/routes/aiRoutes.ts"
click node_ai_controller "https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/backend/src/controllers/aiController.ts"
click node_gemini "https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/backend/src/services/geminiService.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_catalogue,node_search,node_search_results,node_document_data toneBlue
class node_document_detail,node_requirements,node_application_guide,node_apply_channels,node_center_data toneAmber
class node_app,node_translations,node_translation_data,node_interface_translations,node_auth_context,node_assistant_ui toneMint
class node_auth_api,node_backend_auth_routes,node_backend_auth_controller,node_auth_logic,node_user_store,node_assistant_logic,node_ai_routes,node_ai_controller,node_gemini toneRose
class node_citizen_actor toneIndigo
```

## Components

### Document discovery

- [Document catalogue](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/pages/DocumentsPage.tsx): `frontend/src/pages/DocumentsPage.tsx`
- [Document search](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/services/documentSearch.ts): `frontend/src/services/documentSearch.ts`
- [Search results](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/pages/SearchResultsPage.tsx): `frontend/src/pages/SearchResultsPage.tsx`
- [Document dossiers](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/data/documentsData.ts): `frontend/src/data/documentsData.ts`

### Application guidance

- [Document overview](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/pages/DocumentDetailPage.tsx): `frontend/src/pages/DocumentDetailPage.tsx`
- [Requirements checklist](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/pages/RequirementsPage.tsx): `frontend/src/pages/RequirementsPage.tsx`
- [Application timeline](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/pages/ApplicationGuidePage.tsx): `frontend/src/pages/ApplicationGuidePage.tsx`
- [Apply locations](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/pages/WhereToApplyPage.tsx): `frontend/src/pages/WhereToApplyPage.tsx`
- [Civic center data](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/data/civicCenters.ts): `frontend/src/data/civicCenters.ts`

### Citizen experience

- [App routing](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Language context](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/hooks/useLanguage.tsx): `frontend/src/hooks/useLanguage.tsx`
- [Localized content](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/data/documentTranslations.ts): `frontend/src/data/documentTranslations.ts`
- [Interface translations](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/data/translations.ts): `frontend/src/data/translations.ts`
- [Citizen session](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/hooks/useAuth.tsx): `frontend/src/hooks/useAuth.tsx`
- [AI assistant](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/components/ai/JansahayAiAssistant.tsx): `frontend/src/components/ai/JansahayAiAssistant.tsx`

### Application services

- [Frontend auth API](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/services/authService.ts): `frontend/src/services/authService.ts`
- [Auth routes](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/backend/src/routes/authRoutes.ts): `backend/src/routes/authRoutes.ts`
- [Auth controller](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/backend/src/controllers/authController.ts): `backend/src/controllers/authController.ts`
- [Auth service](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/backend/src/services/authService.ts): `backend/src/services/authService.ts`
- [User database](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/backend/src/db/database.ts): `backend/src/db/database.ts`
- [Local AI guidance](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/frontend/src/services/jansahayAiService.ts): `frontend/src/services/jansahayAiService.ts`
- [AI routes](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/backend/src/routes/aiRoutes.ts): `backend/src/routes/aiRoutes.ts`
- [AI controller](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/backend/src/controllers/aiController.ts): `backend/src/controllers/aiController.ts`
- [Gemini integration](https://github.com/mundlapudimuneendra-ops/jansahay-ai/blob/main/backend/src/services/geminiService.ts): `backend/src/services/geminiService.ts`

### Other components

- **Citizen**

## Connections

- Citizen → App routing: opens
- App routing → Document catalogue: routes to (evidence: `frontend/src/App.tsx`)
- App routing → Search results: routes to (evidence: `frontend/src/App.tsx`)
- App routing → Document overview: routes to (evidence: `frontend/src/App.tsx`)
- App routing → Requirements checklist: routes to (evidence: `frontend/src/App.tsx`)
- App routing → Application timeline: routes to (evidence: `frontend/src/App.tsx`)
- App routing → Apply locations: routes to (evidence: `frontend/src/App.tsx`)
- Document catalogue → Document dossiers: reads (evidence: `frontend/src/pages/DocumentsPage.tsx`)
- Search results → Document search: queries (evidence: `frontend/src/pages/SearchResultsPage.tsx`)
- Document search → Document dossiers: searches (evidence: `frontend/src/services/documentSearch.ts`)
- Document overview → Document dossiers: reads (evidence: `frontend/src/pages/DocumentDetailPage.tsx`)
- Requirements checklist → Document dossiers: uses dossier
- Application timeline → Document dossiers: reads (evidence: `frontend/src/pages/ApplicationGuidePage.tsx`)
- Apply locations → Document dossiers: reads (evidence: `frontend/src/pages/WhereToApplyPage.tsx`)
- Apply locations → Civic center data: uses locator data
- App routing → Language context: provides language (evidence: `frontend/src/App.tsx`)
- Language context → Localized content: localizes documents (evidence: `frontend/src/hooks/useLanguage.tsx`)
- Language context → Interface translations: loads strings (evidence: `frontend/src/hooks/useLanguage.tsx`)
- App routing → Citizen session: provides session (evidence: `frontend/src/App.tsx`)
- Citizen session → Frontend auth API: calls (evidence: `frontend/src/hooks/useAuth.tsx`)
- Frontend auth API → Auth routes: HTTP requests (evidence: `frontend/src/services/authService.ts`)
- Auth routes → Auth controller: dispatches (evidence: `backend/src/routes/authRoutes.ts`)
- Auth controller → Auth service: delegates (evidence: `backend/src/controllers/authController.ts`)
- Auth service → User database: reads and writes (evidence: `backend/src/services/authService.ts`)
- App routing → AI assistant: renders (evidence: `frontend/src/App.tsx`)
- AI assistant → Local AI guidance: requests guidance (evidence: `frontend/src/components/ai/JansahayAiAssistant.tsx`)
- Local AI guidance → Document search: normalizes queries (evidence: `frontend/src/services/jansahayAiService.ts`)
- Local AI guidance → Document dossiers: grounds answers (evidence: `frontend/src/services/jansahayAiService.ts`)
- Local AI guidance → Localized content: localizes answers (evidence: `frontend/src/services/jansahayAiService.ts`)
- Local AI guidance → AI routes: optional API
- AI routes → AI controller: dispatches (evidence: `backend/src/routes/aiRoutes.ts`)
- AI controller → Gemini integration: generates response (evidence: `backend/src/controllers/aiController.ts`)
