# subukavya/govscheme architecture

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

- Interactive diagram: https://gitdiagram.com/subukavya/govscheme
- Repository: https://github.com/subukavya/govscheme

## Overview

GovScheme AI helps citizens find welfare schemes, assess eligibility, prepare documents, and track applications; administrators manage schemes and oversee operations. The citizen journey is coordinated by the React app, with discovery and eligibility as key domain stages, and a Node/Express backend providing APIs and persistence. The README documents capabilities beyond the sampled code, so those are included without asserting unverified internal call paths. Some frontend and backend subsystems are represented at their exact tree paths; their detailed wiring was not sampled.

Main entry points: [`src/App.tsx`](https://github.com/subukavya/govscheme/blob/main/src/App.tsx) (Application shell), [`src/components/SchemeDiscovery.tsx`](https://github.com/subukavya/govscheme/blob/main/src/components/SchemeDiscovery.tsx) (Scheme discovery), [`server/server.js`](https://github.com/subukavya/govscheme/blob/main/server/server.js) (HTTP server), [`server/routes/schemeRoutes.js`](https://github.com/subukavya/govscheme/blob/main/server/routes/schemeRoutes.js) (Scheme routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_citizen["Citizen experience"]
  node_app["Application shell<br/>[App.tsx]"]
  node_discovery["Scheme discovery"]
  node_wizard["Eligibility wizard"]
  node_assistant["AI assistant<br/>[AIAssistant.tsx]"]
  node_profile["Citizen profile<br/>[ProfileView.tsx]"]
  node_vault["Document vault<br/>[DocumentVault.tsx]"]
  node_ocr["OCR scanner<br/>[OCRScanner.tsx]"]
  node_ocrservice["OCR service<br/>[ocrService.ts]"]
  node_tracker["Application tracker"]
  node_kiosk["CSC kiosk<br/>[KioskMode.tsx]"]
  node_locales["Localization<br/>[i18n.ts]"]
end

subgraph group_admin["Administration"]
  node_admin["Admin platform<br/>[AdminPlatform.tsx]"]
  node_analytics["Admin analytics<br/>[AdminAnalytics.tsx]"]
  node_schemeops["Scheme operations"]
end

subgraph group_backend["Backend services"]
  node_api["API client<br/>[apiClient.ts]"]
  node_server["HTTP server<br/>[server.js]"]
  node_routes["Scheme routes<br/>[schemeRoutes.js]"]
  node_schemecontroller["Scheme controller"]
  node_auth["Authentication<br/>[authController.js]"]
  node_authmw["Access control<br/>[authMiddleware.js]"]
  node_applications["Application service"]
  node_notifications["Notifications"]
  node_userstore[("User records<br/>[User.js]")]
  node_schemestore[("Scheme records<br/>[Scheme.js]")]
  node_applicationstore[("Application records<br/>[Application.js]")]
end

subgraph group_domain["Eligibility and data"]
  node_ruleengine["Eligibility rules<br/>[ruleEngine.ts]"]
  node_mlengine["Recommendation scoring<br/>[mlEngine.ts]"]
  node_backendrules["Backend eligibility"]
  node_schemefeed["Scheme catalog<br/>[schemes.ts]"]
end

node_citizen(("Citizen"))

node_citizen -->|"uses"| node_app
node_app -->|"presents"| node_discovery
node_app -->|"presents"| node_wizard
node_app -->|"offers"| node_assistant
node_app -->|"presents"| node_profile
node_app -->|"offers"| node_vault
node_app -->|"offers"| node_ocr
node_ocr -.->|"uses"| node_ocrservice
node_app -->|"presents"| node_tracker
node_app -->|"presents"| node_kiosk
node_app -->|"localizes"| node_locales
node_discovery -->|"checks eligibility"| node_ruleengine
node_discovery -->|"ranks matches"| node_mlengine
node_discovery -->|"browses schemes"| node_schemefeed
node_admin -->|"manages schemes"| node_schemeops
node_admin -->|"views metrics"| node_analytics
node_app -->|"opens"| node_admin
node_api -.->|"calls APIs"| node_server
node_server -->|"mounts"| node_routes
node_routes -->|"routes requests"| node_schemecontroller
node_routes -->|"protects routes"| node_authmw
node_schemecontroller -->|"evaluates eligibility"| node_backendrules
node_schemecontroller -->|"queries schemes"| node_schemestore
node_auth -->|"authenticates users"| node_userstore
node_authmw -->|"loads user"| node_userstore
node_applications -->|"records applications"| node_applicationstore
node_notifications -->|"looks up users"| node_userstore
node_server -->|"seeds catalog"| node_schemefeed

click node_app "https://github.com/subukavya/govscheme/blob/main/src/App.tsx"
click node_discovery "https://github.com/subukavya/govscheme/blob/main/src/components/SchemeDiscovery.tsx"
click node_wizard "https://github.com/subukavya/govscheme/blob/main/src/components/EligibilityWizard.tsx"
click node_assistant "https://github.com/subukavya/govscheme/blob/main/src/components/AIAssistant.tsx"
click node_profile "https://github.com/subukavya/govscheme/blob/main/src/components/ProfileView.tsx"
click node_vault "https://github.com/subukavya/govscheme/blob/main/src/components/DocumentVault.tsx"
click node_ocr "https://github.com/subukavya/govscheme/blob/main/src/components/OCRScanner.tsx"
click node_ocrservice "https://github.com/subukavya/govscheme/blob/main/src/services/ocrService.ts"
click node_tracker "https://github.com/subukavya/govscheme/blob/main/src/components/ApplicationTracker.tsx"
click node_kiosk "https://github.com/subukavya/govscheme/blob/main/src/components/KioskMode.tsx"
click node_locales "https://github.com/subukavya/govscheme/blob/main/src/i18n.ts"
click node_admin "https://github.com/subukavya/govscheme/blob/main/src/components/admin/AdminPlatform.tsx"
click node_analytics "https://github.com/subukavya/govscheme/blob/main/src/components/admin/AdminAnalytics.tsx"
click node_schemeops "https://github.com/subukavya/govscheme/blob/main/src/components/admin/SchemeOperationsView.tsx"
click node_api "https://github.com/subukavya/govscheme/blob/main/src/api/apiClient.ts"
click node_server "https://github.com/subukavya/govscheme/blob/main/server/server.js"
click node_routes "https://github.com/subukavya/govscheme/blob/main/server/routes/schemeRoutes.js"
click node_schemecontroller "https://github.com/subukavya/govscheme/blob/main/server/controllers/schemeController.js"
click node_auth "https://github.com/subukavya/govscheme/blob/main/server/controllers/authController.js"
click node_authmw "https://github.com/subukavya/govscheme/blob/main/server/middleware/authMiddleware.js"
click node_applications "https://github.com/subukavya/govscheme/blob/main/server/controllers/applicationController.js"
click node_notifications "https://github.com/subukavya/govscheme/blob/main/server/controllers/notificationController.js"
click node_userstore "https://github.com/subukavya/govscheme/blob/main/server/models/User.js"
click node_schemestore "https://github.com/subukavya/govscheme/blob/main/server/models/Scheme.js"
click node_applicationstore "https://github.com/subukavya/govscheme/blob/main/server/models/Application.js"
click node_ruleengine "https://github.com/subukavya/govscheme/blob/main/src/engine/ruleEngine.ts"
click node_mlengine "https://github.com/subukavya/govscheme/blob/main/src/engine/mlEngine.ts"
click node_backendrules "https://github.com/subukavya/govscheme/blob/main/server/services/eligibilityEngine.js"
click node_schemefeed "https://github.com/subukavya/govscheme/blob/main/src/data/schemes.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_app,node_discovery,node_wizard,node_assistant,node_profile,node_vault,node_ocr,node_ocrservice,node_tracker,node_kiosk,node_locales toneBlue
class node_admin,node_analytics,node_schemeops toneAmber
class node_api,node_server,node_routes,node_schemecontroller,node_auth,node_authmw,node_applications,node_notifications,node_userstore,node_schemestore,node_applicationstore toneMint
class node_ruleengine,node_mlengine,node_backendrules,node_schemefeed toneRose
class node_citizen toneIndigo
```

## Components

### Citizen experience

- [Application shell](https://github.com/subukavya/govscheme/blob/main/src/App.tsx): `src/App.tsx`
- [Scheme discovery](https://github.com/subukavya/govscheme/blob/main/src/components/SchemeDiscovery.tsx): `src/components/SchemeDiscovery.tsx`
- [Eligibility wizard](https://github.com/subukavya/govscheme/blob/main/src/components/EligibilityWizard.tsx): `src/components/EligibilityWizard.tsx`
- [AI assistant](https://github.com/subukavya/govscheme/blob/main/src/components/AIAssistant.tsx): `src/components/AIAssistant.tsx`
- [Citizen profile](https://github.com/subukavya/govscheme/blob/main/src/components/ProfileView.tsx): `src/components/ProfileView.tsx`
- [Document vault](https://github.com/subukavya/govscheme/blob/main/src/components/DocumentVault.tsx): `src/components/DocumentVault.tsx`
- [OCR scanner](https://github.com/subukavya/govscheme/blob/main/src/components/OCRScanner.tsx): `src/components/OCRScanner.tsx`
- [OCR service](https://github.com/subukavya/govscheme/blob/main/src/services/ocrService.ts): `src/services/ocrService.ts`
- [Application tracker](https://github.com/subukavya/govscheme/blob/main/src/components/ApplicationTracker.tsx): `src/components/ApplicationTracker.tsx`
- [CSC kiosk](https://github.com/subukavya/govscheme/blob/main/src/components/KioskMode.tsx): `src/components/KioskMode.tsx`
- [Localization](https://github.com/subukavya/govscheme/blob/main/src/i18n.ts): `src/i18n.ts`

### Administration

- [Admin platform](https://github.com/subukavya/govscheme/blob/main/src/components/admin/AdminPlatform.tsx): `src/components/admin/AdminPlatform.tsx`
- [Admin analytics](https://github.com/subukavya/govscheme/blob/main/src/components/admin/AdminAnalytics.tsx): `src/components/admin/AdminAnalytics.tsx`
- [Scheme operations](https://github.com/subukavya/govscheme/blob/main/src/components/admin/SchemeOperationsView.tsx): `src/components/admin/SchemeOperationsView.tsx`

### Backend services

- [API client](https://github.com/subukavya/govscheme/blob/main/src/api/apiClient.ts): `src/api/apiClient.ts`
- [HTTP server](https://github.com/subukavya/govscheme/blob/main/server/server.js): `server/server.js`
- [Scheme routes](https://github.com/subukavya/govscheme/blob/main/server/routes/schemeRoutes.js): `server/routes/schemeRoutes.js`
- [Scheme controller](https://github.com/subukavya/govscheme/blob/main/server/controllers/schemeController.js): `server/controllers/schemeController.js`
- [Authentication](https://github.com/subukavya/govscheme/blob/main/server/controllers/authController.js): `server/controllers/authController.js`
- [Access control](https://github.com/subukavya/govscheme/blob/main/server/middleware/authMiddleware.js): `server/middleware/authMiddleware.js`
- [Application service](https://github.com/subukavya/govscheme/blob/main/server/controllers/applicationController.js): `server/controllers/applicationController.js`
- [Notifications](https://github.com/subukavya/govscheme/blob/main/server/controllers/notificationController.js): `server/controllers/notificationController.js`
- [User records](https://github.com/subukavya/govscheme/blob/main/server/models/User.js): `server/models/User.js`
- [Scheme records](https://github.com/subukavya/govscheme/blob/main/server/models/Scheme.js): `server/models/Scheme.js`
- [Application records](https://github.com/subukavya/govscheme/blob/main/server/models/Application.js): `server/models/Application.js`

### Eligibility and data

- [Eligibility rules](https://github.com/subukavya/govscheme/blob/main/src/engine/ruleEngine.ts): `src/engine/ruleEngine.ts`
- [Recommendation scoring](https://github.com/subukavya/govscheme/blob/main/src/engine/mlEngine.ts): `src/engine/mlEngine.ts`
- [Backend eligibility](https://github.com/subukavya/govscheme/blob/main/server/services/eligibilityEngine.js): `server/services/eligibilityEngine.js`
- [Scheme catalog](https://github.com/subukavya/govscheme/blob/main/src/data/schemes.ts): `src/data/schemes.ts`

### Other components

- **Citizen**

## Connections

- Citizen → Application shell: uses (evidence: `README.md`)
- Application shell → Scheme discovery: presents (evidence: `src/App.tsx`)
- Application shell → Eligibility wizard: presents (evidence: `src/App.tsx`)
- Application shell → AI assistant: offers (evidence: `README.md`)
- Application shell → Citizen profile: presents (evidence: `src/App.tsx`)
- Application shell → Document vault: offers (evidence: `README.md`)
- Application shell → OCR scanner: offers (evidence: `README.md`)
- OCR scanner → OCR service: uses
- Application shell → Application tracker: presents (evidence: `README.md`)
- Application shell → CSC kiosk: presents (evidence: `src/App.tsx`)
- Application shell → Localization: localizes (evidence: `src/App.tsx`)
- Scheme discovery → Eligibility rules: checks eligibility (evidence: `README.md`)
- Scheme discovery → Recommendation scoring: ranks matches (evidence: `README.md`)
- Scheme discovery → Scheme catalog: browses schemes (evidence: `README.md`)
- Admin platform → Scheme operations: manages schemes (evidence: `README.md`)
- Admin platform → Admin analytics: views metrics (evidence: `README.md`)
- Application shell → Admin platform: opens (evidence: `src/App.tsx`)
- API client → HTTP server: calls APIs
- HTTP server → Scheme routes: mounts (evidence: `server/server.js`)
- Scheme routes → Scheme controller: routes requests (evidence: `server/routes/schemeRoutes.js`)
- Scheme routes → Access control: protects routes (evidence: `server/routes/schemeRoutes.js`)
- Scheme controller → Backend eligibility: evaluates eligibility (evidence: `server/controllers/schemeController.js`)
- Scheme controller → Scheme records: queries schemes (evidence: `server/controllers/schemeController.js`)
- Authentication → User records: authenticates users (evidence: `server/controllers/authController.js`)
- Access control → User records: loads user (evidence: `server/middleware/authMiddleware.js`)
- Application service → Application records: records applications (evidence: `server/controllers/applicationController.js`)
- Notifications → User records: looks up users (evidence: `server/controllers/notificationController.js`)
- HTTP server → Scheme catalog: seeds catalog (evidence: `server/server.js`)
