# shravistadokuparthi/yojantha architecture

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

- Interactive diagram: https://gitdiagram.com/shravistadokuparthi/yojantha
- Repository: https://github.com/shravistadokuparthi/yojantha

## Overview

Yojantha is a citizen-facing government-scheme discovery and tracking platform. A typical workflow is to create an account, maintain a profile, get scheme recommendations, explore scheme details or ask the chatbot, and mark schemes as interested or applied. The backend also stores scheme data, supports semantic recommendation and chat, and schedules reminders. The graph follows explicit imports and calls where available; broader frontend-to-API interactions and government-data synchronization are documented capabilities but their wiring is not shown in the sampled source.

Main entry points: [`backend/models/Schemes.js`](https://github.com/shravistadokuparthi/yojantha/blob/main/backend/models/Schemes.js) (Scheme records), [`frontend/src/pages/dashboard.jsx`](https://github.com/shravistadokuparthi/yojantha/blob/main/frontend/src/pages/dashboard.jsx) (Dashboard), [`backend/server.js`](https://github.com/shravistadokuparthi/yojantha/blob/main/backend/server.js) (Express server), [`backend/models/User.js`](https://github.com/shravistadokuparthi/yojantha/blob/main/backend/models/User.js) (User records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Citizen web app"]
  node_app["Page router<br/>[App.jsx]"]
  node_dashboard["Dashboard<br/>[dashboard.jsx]"]
  node_home["Home<br/>[home.jsx]"]
  node_profile_ui["Profile page<br/>[profile.jsx]"]
  node_schemes_ui["Scheme browser<br/>[schemes.jsx]"]
  node_recommend_ui["Recommendations"]
  node_my_schemes["My schemes<br/>[MySchemes.jsx]"]
  node_chatbot_ui["Chatbot UI<br/>[Chatbot.jsx]"]
  node_thematic_bg["Thematic background"]
end

subgraph group_identity["Identity and profiles"]
  node_auth_routes["Auth routes<br/>[authRoutes.js]"]
  node_auth_controller["Account controller<br/>[authController.js]"]
  node_profile_routes["Profile routes<br/>[profileRoutes.js]"]
  node_profile_controller["Profile controller"]
  node_auth_middleware["JWT middleware<br/>[authMiddleware.js]"]
  node_user_model[("User records<br/>[User.js]")]
  node_otp_model[("OTP records<br/>[OTP.js]")]
end

subgraph group_schemes["Scheme discovery"]
  node_scheme_routes["Scheme routes<br/>[schemesRoutes.js]"]
  node_scheme_controller["Scheme controller"]
  node_ai_routes["Recommendations API<br/>[airoutes.js]"]
  node_chat_routes["Chat API<br/>[chatRoutes.js]"]
  node_scheme_model[("Scheme records<br/>[Schemes.js]")]
  node_embedding_job["Embedding generation"]
end

subgraph group_platform["Platform services"]
  node_apply_routes["Application tracking<br/>[applyRoutes.js]"]
  node_reminders["Scheme reminders<br/>[schemeReminders.js]"]
  node_email["Email service<br/>[emailService.js]"]
  node_server["Express server<br/>[server.js]"]
end

node_citizen(("Citizen"))
node_mongo[("MongoDB")]
node_gov_data["Government data source"]
node_mail_provider["SMTP provider"]

node_citizen -->|"uses"| node_app
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_recommend_ui
node_app -->|"routes to"| node_my_schemes
node_dashboard -->|"renders"| node_home
node_dashboard -->|"renders"| node_profile_ui
node_dashboard -->|"renders"| node_schemes_ui
node_dashboard -->|"renders"| node_recommend_ui
node_dashboard -->|"renders"| node_my_schemes
node_dashboard -->|"renders"| node_chatbot_ui
node_dashboard -->|"uses"| node_thematic_bg
node_server -->|"mounts"| node_auth_routes
node_server -->|"mounts"| node_profile_routes
node_server -->|"mounts"| node_scheme_routes
node_server -->|"mounts"| node_apply_routes
node_server -->|"mounts"| node_ai_routes
node_server -->|"mounts"| node_chat_routes
node_server -->|"initializes"| node_reminders
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_controller -->|"reads and writes"| node_user_model
node_auth_controller -->|"verifies OTP"| node_otp_model
node_auth_controller -->|"sends OTP"| node_email
node_profile_routes -->|"authenticates"| node_auth_middleware
node_profile_routes -->|"dispatches"| node_profile_controller
node_profile_controller -->|"reads and updates"| node_user_model
node_apply_routes -->|"authenticates"| node_auth_middleware
node_apply_routes -->|"updates tracking"| node_user_model
node_scheme_routes -->|"queries"| node_scheme_model
node_scheme_routes -.->|"dispatches"| node_scheme_controller
node_ai_routes -->|"retrieves candidates"| node_scheme_model
node_chat_routes -->|"retrieves schemes"| node_scheme_model
node_embedding_job -->|"updates embeddings"| node_scheme_model
node_reminders -->|"reads recipients"| node_user_model
node_reminders -->|"reads schemes"| node_scheme_model
node_reminders -->|"sends reminders"| node_email
node_scheme_model -->|"finds recipients"| node_user_model
node_scheme_model -->|"notifies new schemes"| node_email
node_email -->|"sends mail"| node_mail_provider
node_user_model -.->|"persists records"| node_mongo
node_scheme_model -.->|"persists records"| node_mongo
node_recommend_ui -.->|"requests recommendations"| node_ai_routes
node_chatbot_ui -.->|"sends questions"| node_chat_routes
node_profile_ui -.->|"updates profile"| node_profile_routes
node_my_schemes -.->|"tracks choices"| node_apply_routes
node_gov_data -.->|"supplies scheme data"| node_scheme_model

click node_app "https://github.com/shravistadokuparthi/yojantha/blob/main/frontend/src/App.jsx"
click node_dashboard "https://github.com/shravistadokuparthi/yojantha/blob/main/frontend/src/pages/dashboard.jsx"
click node_home "https://github.com/shravistadokuparthi/yojantha/blob/main/frontend/src/pages/home.jsx"
click node_profile_ui "https://github.com/shravistadokuparthi/yojantha/blob/main/frontend/src/pages/profile.jsx"
click node_schemes_ui "https://github.com/shravistadokuparthi/yojantha/blob/main/frontend/src/pages/schemes.jsx"
click node_recommend_ui "https://github.com/shravistadokuparthi/yojantha/blob/main/frontend/src/pages/recommendations.jsx"
click node_my_schemes "https://github.com/shravistadokuparthi/yojantha/blob/main/frontend/src/pages/MySchemes.jsx"
click node_chatbot_ui "https://github.com/shravistadokuparthi/yojantha/blob/main/frontend/src/pages/Chatbot.jsx"
click node_thematic_bg "https://github.com/shravistadokuparthi/yojantha/blob/main/frontend/src/components/ThematicBackground.jsx"
click node_auth_routes "https://github.com/shravistadokuparthi/yojantha/blob/main/backend/routes/authRoutes.js"
click node_auth_controller "https://github.com/shravistadokuparthi/yojantha/blob/main/backend/controllers/authController.js"
click node_profile_routes "https://github.com/shravistadokuparthi/yojantha/blob/main/backend/routes/profileRoutes.js"
click node_profile_controller "https://github.com/shravistadokuparthi/yojantha/blob/main/backend/controllers/profileController.js"
click node_auth_middleware "https://github.com/shravistadokuparthi/yojantha/blob/main/backend/middleware/authMiddleware.js"
click node_user_model "https://github.com/shravistadokuparthi/yojantha/blob/main/backend/models/User.js"
click node_scheme_routes "https://github.com/shravistadokuparthi/yojantha/blob/main/backend/routes/schemesRoutes.js"
click node_scheme_controller "https://github.com/shravistadokuparthi/yojantha/blob/main/backend/controllers/SchemesController.js"
click node_ai_routes "https://github.com/shravistadokuparthi/yojantha/blob/main/backend/routes/airoutes.js"
click node_chat_routes "https://github.com/shravistadokuparthi/yojantha/blob/main/backend/routes/chatRoutes.js"
click node_scheme_model "https://github.com/shravistadokuparthi/yojantha/blob/main/backend/models/Schemes.js"
click node_embedding_job "https://github.com/shravistadokuparthi/yojantha/blob/main/backend/Scripts/generateEmbeddings.js"
click node_apply_routes "https://github.com/shravistadokuparthi/yojantha/blob/main/backend/routes/applyRoutes.js"
click node_reminders "https://github.com/shravistadokuparthi/yojantha/blob/main/backend/cron/schemeReminders.js"
click node_email "https://github.com/shravistadokuparthi/yojantha/blob/main/backend/utils/emailService.js"
click node_otp_model "https://github.com/shravistadokuparthi/yojantha/blob/main/backend/models/OTP.js"
click node_server "https://github.com/shravistadokuparthi/yojantha/blob/main/backend/server.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_app,node_dashboard,node_home,node_profile_ui,node_schemes_ui,node_recommend_ui,node_my_schemes,node_chatbot_ui,node_thematic_bg toneBlue
class node_auth_routes,node_auth_controller,node_profile_routes,node_profile_controller,node_auth_middleware,node_user_model,node_otp_model,node_mongo toneAmber
class node_scheme_routes,node_scheme_controller,node_ai_routes,node_chat_routes,node_scheme_model,node_embedding_job toneMint
class node_apply_routes,node_reminders,node_email,node_server toneRose
class node_citizen,node_gov_data,node_mail_provider toneIndigo
```

## Components

### Citizen web app

- [Page router](https://github.com/shravistadokuparthi/yojantha/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Dashboard](https://github.com/shravistadokuparthi/yojantha/blob/main/frontend/src/pages/dashboard.jsx): `frontend/src/pages/dashboard.jsx`
- [Home](https://github.com/shravistadokuparthi/yojantha/blob/main/frontend/src/pages/home.jsx): `frontend/src/pages/home.jsx`
- [Profile page](https://github.com/shravistadokuparthi/yojantha/blob/main/frontend/src/pages/profile.jsx): `frontend/src/pages/profile.jsx`
- [Scheme browser](https://github.com/shravistadokuparthi/yojantha/blob/main/frontend/src/pages/schemes.jsx): `frontend/src/pages/schemes.jsx`
- [Recommendations](https://github.com/shravistadokuparthi/yojantha/blob/main/frontend/src/pages/recommendations.jsx): `frontend/src/pages/recommendations.jsx`
- [My schemes](https://github.com/shravistadokuparthi/yojantha/blob/main/frontend/src/pages/MySchemes.jsx): `frontend/src/pages/MySchemes.jsx`
- [Chatbot UI](https://github.com/shravistadokuparthi/yojantha/blob/main/frontend/src/pages/Chatbot.jsx): `frontend/src/pages/Chatbot.jsx`
- [Thematic background](https://github.com/shravistadokuparthi/yojantha/blob/main/frontend/src/components/ThematicBackground.jsx): `frontend/src/components/ThematicBackground.jsx`

### Identity and profiles

- [Auth routes](https://github.com/shravistadokuparthi/yojantha/blob/main/backend/routes/authRoutes.js): `backend/routes/authRoutes.js`
- [Account controller](https://github.com/shravistadokuparthi/yojantha/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [Profile routes](https://github.com/shravistadokuparthi/yojantha/blob/main/backend/routes/profileRoutes.js): `backend/routes/profileRoutes.js`
- [Profile controller](https://github.com/shravistadokuparthi/yojantha/blob/main/backend/controllers/profileController.js): `backend/controllers/profileController.js`
- [JWT middleware](https://github.com/shravistadokuparthi/yojantha/blob/main/backend/middleware/authMiddleware.js): `backend/middleware/authMiddleware.js`
- [User records](https://github.com/shravistadokuparthi/yojantha/blob/main/backend/models/User.js): `backend/models/User.js`
- [OTP records](https://github.com/shravistadokuparthi/yojantha/blob/main/backend/models/OTP.js): `backend/models/OTP.js`

### Scheme discovery

- [Scheme routes](https://github.com/shravistadokuparthi/yojantha/blob/main/backend/routes/schemesRoutes.js): `backend/routes/schemesRoutes.js`
- [Scheme controller](https://github.com/shravistadokuparthi/yojantha/blob/main/backend/controllers/SchemesController.js): `backend/controllers/SchemesController.js`
- [Recommendations API](https://github.com/shravistadokuparthi/yojantha/blob/main/backend/routes/airoutes.js): `backend/routes/airoutes.js`
- [Chat API](https://github.com/shravistadokuparthi/yojantha/blob/main/backend/routes/chatRoutes.js): `backend/routes/chatRoutes.js`
- [Scheme records](https://github.com/shravistadokuparthi/yojantha/blob/main/backend/models/Schemes.js): `backend/models/Schemes.js`
- [Embedding generation](https://github.com/shravistadokuparthi/yojantha/blob/main/backend/Scripts/generateEmbeddings.js): `backend/Scripts/generateEmbeddings.js`

### Platform services

- [Application tracking](https://github.com/shravistadokuparthi/yojantha/blob/main/backend/routes/applyRoutes.js): `backend/routes/applyRoutes.js`
- [Scheme reminders](https://github.com/shravistadokuparthi/yojantha/blob/main/backend/cron/schemeReminders.js): `backend/cron/schemeReminders.js`
- [Email service](https://github.com/shravistadokuparthi/yojantha/blob/main/backend/utils/emailService.js): `backend/utils/emailService.js`
- [Express server](https://github.com/shravistadokuparthi/yojantha/blob/main/backend/server.js): `backend/server.js`

### Other components

- **Citizen**
- **MongoDB**
- **Government data source**
- **SMTP provider**

## Connections

- Citizen → Page router: uses (evidence: `README.md`)
- Page router → Dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Recommendations: routes to (evidence: `frontend/src/App.jsx`)
- Page router → My schemes: routes to (evidence: `frontend/src/App.jsx`)
- Dashboard → Home: renders (evidence: `frontend/src/pages/dashboard.jsx`)
- Dashboard → Profile page: renders (evidence: `frontend/src/pages/dashboard.jsx`)
- Dashboard → Scheme browser: renders (evidence: `frontend/src/pages/dashboard.jsx`)
- Dashboard → Recommendations: renders (evidence: `frontend/src/pages/dashboard.jsx`)
- Dashboard → My schemes: renders (evidence: `frontend/src/pages/dashboard.jsx`)
- Dashboard → Chatbot UI: renders (evidence: `frontend/src/pages/dashboard.jsx`)
- Dashboard → Thematic background: uses (evidence: `frontend/src/pages/dashboard.jsx`)
- Express server → Auth routes: mounts (evidence: `backend/server.js`)
- Express server → Profile routes: mounts (evidence: `backend/server.js`)
- Express server → Scheme routes: mounts (evidence: `backend/server.js`)
- Express server → Application tracking: mounts (evidence: `backend/server.js`)
- Express server → Recommendations API: mounts (evidence: `backend/server.js`)
- Express server → Chat API: mounts (evidence: `backend/server.js`)
- Express server → Scheme reminders: initializes (evidence: `backend/server.js`)
- Auth routes → Account controller: dispatches (evidence: `backend/routes/authRoutes.js`)
- Account controller → User records: reads and writes (evidence: `backend/controllers/authController.js`)
- Account controller → OTP records: verifies OTP (evidence: `backend/controllers/authController.js`)
- Account controller → Email service: sends OTP (evidence: `backend/controllers/authController.js`)
- Profile routes → JWT middleware: authenticates (evidence: `backend/routes/profileRoutes.js`)
- Profile routes → Profile controller: dispatches (evidence: `backend/routes/profileRoutes.js`)
- Profile controller → User records: reads and updates (evidence: `backend/controllers/profileController.js`)
- Application tracking → JWT middleware: authenticates (evidence: `backend/routes/applyRoutes.js`)
- Application tracking → User records: updates tracking (evidence: `backend/routes/applyRoutes.js`)
- Scheme routes → Scheme records: queries (evidence: `backend/routes/schemesRoutes.js`)
- Scheme routes → Scheme controller: dispatches
- Recommendations API → Scheme records: retrieves candidates (evidence: `backend/routes/airoutes.js`)
- Chat API → Scheme records: retrieves schemes (evidence: `backend/routes/chatRoutes.js`)
- Embedding generation → Scheme records: updates embeddings (evidence: `backend/Scripts/generateEmbeddings.js`)
- Scheme reminders → User records: reads recipients (evidence: `backend/cron/schemeReminders.js`)
- Scheme reminders → Scheme records: reads schemes (evidence: `backend/cron/schemeReminders.js`)
- Scheme reminders → Email service: sends reminders (evidence: `backend/cron/schemeReminders.js`)
- Scheme records → User records: finds recipients (evidence: `backend/models/Schemes.js`)
- Scheme records → Email service: notifies new schemes (evidence: `backend/models/Schemes.js`)
- Email service → SMTP provider: sends mail (evidence: `backend/utils/emailService.js`)
- User records → MongoDB: persists records
- Scheme records → MongoDB: persists records
- Recommendations → Recommendations API: requests recommendations
- Chatbot UI → Chat API: sends questions
- Profile page → Profile routes: updates profile
- My schemes → Application tracking: tracks choices
- Government data source → Scheme records: supplies scheme data
