# revanth1310/scheme-assist architecture

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

- Interactive diagram: https://gitdiagram.com/revanth1310/scheme-assist
- Repository: https://github.com/revanth1310/scheme-assist

## Overview

Scheme Assist guides users from a text or voice question to scheme discovery, scheme-specific explanations, or general guidance. The FastAPI entry point handles chat and account flows; the agent routes questions to eligibility-oriented search, scheme explanation, or general chat, then translates the response. Documented voice output is also exposed. The graph reflects sampled source and README capabilities; RAG is documented, but its implementation and wiring are not evident in the sampled files.

Main entry points: [`backend/main.py`](https://github.com/revanth1310/scheme-assist/blob/main/backend/main.py) (FastAPI API), [`backend/agent.py`](https://github.com/revanth1310/scheme-assist/blob/main/backend/agent.py) (Agent Router), [`backend/tools/search_for_schemes.py`](https://github.com/revanth1310/scheme-assist/blob/main/backend/tools/search_for_schemes.py) (Scheme Search Tool), [`backend/auth.py`](https://github.com/revanth1310/scheme-assist/blob/main/backend/auth.py) (Account Logic)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User Experience"]
  node_login_ui["Login UI<br/>[login.html]"]
  node_chat_ui["Chat UI<br/>[chat.html]"]
end

subgraph group_api_identity["API and Identity"]
  node_api["FastAPI API<br/>[main.py]"]
  node_auth["Account Logic<br/>[auth.py]"]
  node_jwt["JWT Utilities<br/>[security.py]"]
  node_user_model["User Model<br/>[models.py]"]
  node_database[("SQLite Database<br/>[database.py]")]
end

subgraph group_agent_guidance["Agent and Guidance"]
  node_agent["Agent Router<br/>[agent.py]"]
  node_search_tool["Scheme Search Tool"]
  node_automation["Eligibility Automation<br/>[scheme_search.py]"]
  node_scraper["Scheme Scraper<br/>[schemes.py]"]
  node_generate_tool["Explanation Tool"]
  node_gemini_util["Scheme Explainer<br/>[gemini.py]"]
end

subgraph group_integrations["External Integrations"]
  node_llm_service["Gemini LLM"]
  node_scheme_portal["myScheme Portal"]
  node_translator["Translation Service"]
  node_speech_services["Speech Services"]
  node_tts_service["Edge TTS"]
end

node_user(("User"))

node_user -->|"uses"| node_login_ui
node_user -->|"asks"| node_chat_ui
node_login_ui -->|"authenticates"| node_api
node_chat_ui -->|"sends chat"| node_api
node_api -->|"creates account"| node_auth
node_api -->|"verifies password"| node_auth
node_api -->|"creates token"| node_jwt
node_api -->|"queries user"| node_user_model
node_api -->|"opens session"| node_database
node_auth -->|"writes user"| node_database
node_api -->|"routes chat"| node_agent
node_api -.->|"transcribes audio"| node_speech_services
node_api -.->|"streams speech"| node_tts_service
node_agent -->|"routes and chats"| node_llm_service
node_agent -->|"dispatches search"| node_search_tool
node_search_tool -->|"automates eligibility"| node_automation
node_search_tool -->|"scrapes schemes"| node_scraper
node_automation -->|"submits profile"| node_scheme_portal
node_scraper -->|"scrapes listings"| node_scheme_portal
node_agent -->|"dispatches explanation"| node_generate_tool
node_generate_tool -->|"requests details"| node_gemini_util
node_gemini_util -->|"generates explanation"| node_llm_service
node_agent -.->|"translates response"| node_translator

click node_login_ui "https://github.com/revanth1310/scheme-assist/blob/main/frontend/login.html"
click node_chat_ui "https://github.com/revanth1310/scheme-assist/blob/main/frontend/chat.html"
click node_api "https://github.com/revanth1310/scheme-assist/blob/main/backend/main.py"
click node_auth "https://github.com/revanth1310/scheme-assist/blob/main/backend/auth.py"
click node_jwt "https://github.com/revanth1310/scheme-assist/blob/main/backend/security.py"
click node_user_model "https://github.com/revanth1310/scheme-assist/blob/main/backend/models.py"
click node_database "https://github.com/revanth1310/scheme-assist/blob/main/backend/database.py"
click node_agent "https://github.com/revanth1310/scheme-assist/blob/main/backend/agent.py"
click node_search_tool "https://github.com/revanth1310/scheme-assist/blob/main/backend/tools/search_for_schemes.py"
click node_automation "https://github.com/revanth1310/scheme-assist/blob/main/backend/utils/scheme_search.py"
click node_scraper "https://github.com/revanth1310/scheme-assist/blob/main/backend/utils/schemes.py"
click node_generate_tool "https://github.com/revanth1310/scheme-assist/blob/main/backend/tools/generate_scheme_info.py"
click node_gemini_util "https://github.com/revanth1310/scheme-assist/blob/main/backend/utils/gemini.py"

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_login_ui,node_chat_ui,node_user toneBlue
class node_api,node_auth,node_jwt,node_user_model,node_database toneAmber
class node_agent,node_search_tool,node_automation,node_scraper,node_generate_tool,node_gemini_util toneMint
class node_llm_service,node_scheme_portal,node_translator,node_speech_services,node_tts_service toneRose
```

## Components

### User Experience

- [Login UI](https://github.com/revanth1310/scheme-assist/blob/main/frontend/login.html): `frontend/login.html`
- [Chat UI](https://github.com/revanth1310/scheme-assist/blob/main/frontend/chat.html): `frontend/chat.html`

### API and Identity

- [FastAPI API](https://github.com/revanth1310/scheme-assist/blob/main/backend/main.py): `backend/main.py`
- [Account Logic](https://github.com/revanth1310/scheme-assist/blob/main/backend/auth.py): `backend/auth.py`
- [JWT Utilities](https://github.com/revanth1310/scheme-assist/blob/main/backend/security.py): `backend/security.py`
- [User Model](https://github.com/revanth1310/scheme-assist/blob/main/backend/models.py): `backend/models.py`
- [SQLite Database](https://github.com/revanth1310/scheme-assist/blob/main/backend/database.py): `backend/database.py`

### Agent and Guidance

- [Agent Router](https://github.com/revanth1310/scheme-assist/blob/main/backend/agent.py): `backend/agent.py`
- [Scheme Search Tool](https://github.com/revanth1310/scheme-assist/blob/main/backend/tools/search_for_schemes.py): `backend/tools/search_for_schemes.py`
- [Eligibility Automation](https://github.com/revanth1310/scheme-assist/blob/main/backend/utils/scheme_search.py): `backend/utils/scheme_search.py`
- [Scheme Scraper](https://github.com/revanth1310/scheme-assist/blob/main/backend/utils/schemes.py): `backend/utils/schemes.py`
- [Explanation Tool](https://github.com/revanth1310/scheme-assist/blob/main/backend/tools/generate_scheme_info.py): `backend/tools/generate_scheme_info.py`
- [Scheme Explainer](https://github.com/revanth1310/scheme-assist/blob/main/backend/utils/gemini.py): `backend/utils/gemini.py`

### External Integrations

- **Gemini LLM**
- **myScheme Portal**
- **Translation Service**
- **Speech Services**
- **Edge TTS**

### Other components

- **User**

## Connections

- User → Login UI: uses
- User → Chat UI: asks
- Login UI → FastAPI API: authenticates
- Chat UI → FastAPI API: sends chat
- FastAPI API → Account Logic: creates account
- FastAPI API → Account Logic: verifies password
- FastAPI API → JWT Utilities: creates token
- FastAPI API → User Model: queries user
- FastAPI API → SQLite Database: opens session
- Account Logic → SQLite Database: writes user
- FastAPI API → Agent Router: routes chat
- FastAPI API → Speech Services: transcribes audio
- FastAPI API → Edge TTS: streams speech
- Agent Router → Gemini LLM: routes and chats
- Agent Router → Scheme Search Tool: dispatches search
- Scheme Search Tool → Eligibility Automation: automates eligibility
- Scheme Search Tool → Scheme Scraper: scrapes schemes
- Eligibility Automation → myScheme Portal: submits profile
- Scheme Scraper → myScheme Portal: scrapes listings
- Agent Router → Explanation Tool: dispatches explanation
- Explanation Tool → Scheme Explainer: requests details
- Scheme Explainer → Gemini LLM: generates explanation
- Agent Router → Translation Service: translates response
