# nikhila-dhevi-r/finaccess-ai architecture

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

- Interactive diagram: https://gitdiagram.com/nikhila-dhevi-r/finaccess-ai
- Repository: https://github.com/nikhila-dhevi-r/finaccess-ai

## Overview

FinAccess-AI is a multilingual, voice-first financial inclusion application. Users start a session, then can complete scanned forms, explore benefit schemes, ask financial questions, or check suspected fraud; the frontend sends these workflows to a FastAPI backend. Form completion includes OCR, spoken-answer interpretation, confirmation, and document generation. The graph includes documented feature areas even where implementation excerpts are limited; edges are based on shown source or SOURCE INDEX references, and uncertain connections are omitted.

Main entry points: [`backend/main.py`](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/main.py) (FastAPI application), [`backend/database.py`](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/database.py) (Database), [`backend/routers/forms.py`](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/routers/forms.py) (Form endpoints), [`frontend/src/api/client.js`](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/frontend/src/api/client.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User experience"]
  node_app["Application shell<br/>[App.jsx]"]
  node_session_ui["Session and language<br/>[useSession.js]"]
  node_speech_ui["Speech interaction<br/>[useSpeech.js]"]
  node_form_ui["Form completion<br/>[FormFill.jsx]"]
  node_fraud_ui["Fraud check<br/>[FraudCheck.jsx]"]
  node_schemes_ui["Scheme discovery<br/>[Schemes.jsx]"]
  node_guidance_ui["Financial guidance<br/>[Guidance.jsx]"]
  node_api_client["API client<br/>[client.js]"]
end

subgraph group_api["API workflows"]
  node_backend["FastAPI application<br/>[main.py]"]
  node_sessions["Session endpoints<br/>[sessions.py]"]
  node_forms["Form endpoints<br/>[forms.py]"]
  node_confirmations["Confirmation endpoints<br/>[confirmations.py]"]
  node_fraud["Fraud endpoints<br/>[fraud.py]"]
  node_schemes["Scheme endpoints<br/>[schemes.py]"]
  node_guidance["Guidance endpoints<br/>[guidance.py]"]
end

subgraph group_services["Domain services"]
  node_ocr["Form OCR<br/>[ocr_service.py]"]
  node_bank_forms["Bank form detection"]
  node_cheques["Cheque processing<br/>[cheque_service.py]"]
  node_voice["Voice interpretation<br/>[voice_service.py]"]
  node_pdf["Document generation<br/>[pdf_service.py]"]
  node_nonce["Challenge handling<br/>[nonce_service.py]"]
  node_fraud_service["Fraud analysis<br/>[fraud_service.py]"]
  node_scam_detector["Scam detection<br/>[scam_detector.py]"]
  node_message_ocr["Message OCR<br/>[message_ocr.py]"]
  node_scheme_service["Scheme matching<br/>[scheme_service.py]"]
  node_scheme_finder["Eligibility finder<br/>[scheme_finder.py]"]
  node_scheme_data["Scheme catalogue<br/>[schemes_data.py]"]
  node_guidance_service["Guidance answers"]
  node_finance_kb["Finance knowledge base<br/>[finance_kb.py]"]
end

subgraph group_state["Persistence"]
  node_database[("Database<br/>[database.py]")]
  node_models["Domain records<br/>[models.py]"]
end

node_user(("User"))

node_user -.->|"uses"| node_app
node_app -->|"routes to"| node_form_ui
node_app -->|"routes to"| node_fraud_ui
node_app -->|"routes to"| node_schemes_ui
node_app -->|"routes to"| node_guidance_ui
node_form_ui -->|"uses"| node_speech_ui
node_form_ui -->|"requests"| node_api_client
node_fraud_ui -->|"requests"| node_api_client
node_schemes_ui -->|"requests"| node_api_client
node_guidance_ui -->|"requests"| node_api_client
node_form_ui -->|"uses"| node_session_ui
node_fraud_ui -->|"uses"| node_session_ui
node_schemes_ui -->|"uses"| node_session_ui
node_guidance_ui -->|"uses"| node_session_ui
node_session_ui -->|"creates session"| node_api_client
node_api_client -.->|"calls API"| node_backend
node_backend -->|"registers"| node_sessions
node_backend -->|"registers"| node_forms
node_backend -->|"registers"| node_confirmations
node_backend -->|"registers"| node_fraud
node_backend -->|"registers"| node_schemes
node_backend -->|"registers"| node_guidance
node_sessions -->|"uses"| node_database
node_forms -->|"processes upload"| node_ocr
node_forms -->|"interprets answers"| node_voice
node_forms -->|"generates document"| node_pdf
node_forms -->|"requests challenge"| node_nonce
node_forms -->|"uses"| node_database
node_confirmations -->|"validates challenge"| node_nonce
node_confirmations -->|"uses"| node_database
node_fraud -->|"analyzes submission"| node_fraud_service
node_fraud -->|"uses"| node_database
node_fraud_service -->|"checks scam"| node_scam_detector
node_fraud_service -->|"extracts message"| node_message_ocr
node_fraud_service -->|"checks cheque"| node_cheques
node_schemes -->|"matches schemes"| node_scheme_service
node_schemes -->|"uses"| node_database
node_scheme_service -->|"finds eligibility"| node_scheme_finder
node_scheme_service -->|"reads catalogue"| node_scheme_data
node_scheme_finder -->|"matches catalogue"| node_scheme_data
node_guidance -->|"answers question"| node_guidance_service
node_guidance -->|"uses"| node_database
node_guidance_service -->|"searches knowledge"| node_finance_kb
node_guidance_service -->|"references schemes"| node_scheme_data
node_guidance_service -->|"checks eligibility"| node_scheme_finder
node_database -->|"maps records"| node_models

click node_app "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/frontend/src/App.jsx"
click node_session_ui "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/frontend/src/hooks/useSession.js"
click node_speech_ui "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/frontend/src/hooks/useSpeech.js"
click node_form_ui "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/frontend/src/pages/FormFill.jsx"
click node_fraud_ui "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/frontend/src/pages/FraudCheck.jsx"
click node_schemes_ui "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/frontend/src/pages/Schemes.jsx"
click node_guidance_ui "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/frontend/src/pages/Guidance.jsx"
click node_api_client "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/frontend/src/api/client.js"
click node_backend "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/main.py"
click node_sessions "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/routers/sessions.py"
click node_forms "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/routers/forms.py"
click node_confirmations "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/routers/confirmations.py"
click node_fraud "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/routers/fraud.py"
click node_schemes "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/routers/schemes.py"
click node_guidance "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/routers/guidance.py"
click node_ocr "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/ocr_service.py"
click node_bank_forms "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/bank_form_service.py"
click node_cheques "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/cheque_service.py"
click node_voice "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/voice_service.py"
click node_pdf "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/pdf_service.py"
click node_nonce "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/nonce_service.py"
click node_fraud_service "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/fraud_service.py"
click node_scam_detector "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/scam_detector.py"
click node_message_ocr "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/message_ocr.py"
click node_scheme_service "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/scheme_service.py"
click node_scheme_finder "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/scheme_finder.py"
click node_scheme_data "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/schemes_data.py"
click node_guidance_service "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/guidance_service.py"
click node_finance_kb "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/finance_kb.py"
click node_database "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/database.py"
click node_models "https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/models.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_app,node_session_ui,node_speech_ui,node_form_ui,node_fraud_ui,node_schemes_ui,node_guidance_ui,node_api_client,node_user toneBlue
class node_backend,node_sessions,node_forms,node_confirmations,node_fraud,node_schemes,node_guidance toneAmber
class node_ocr,node_bank_forms,node_cheques,node_voice,node_pdf,node_nonce,node_fraud_service,node_scam_detector,node_message_ocr,node_scheme_service,node_scheme_finder,node_scheme_data,node_guidance_service,node_finance_kb toneMint
class node_database,node_models toneRose
```

## Components

### User experience

- [Application shell](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Session and language](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/frontend/src/hooks/useSession.js): `frontend/src/hooks/useSession.js`
- [Speech interaction](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/frontend/src/hooks/useSpeech.js): `frontend/src/hooks/useSpeech.js`
- [Form completion](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/frontend/src/pages/FormFill.jsx): `frontend/src/pages/FormFill.jsx`
- [Fraud check](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/frontend/src/pages/FraudCheck.jsx): `frontend/src/pages/FraudCheck.jsx`
- [Scheme discovery](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/frontend/src/pages/Schemes.jsx): `frontend/src/pages/Schemes.jsx`
- [Financial guidance](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/frontend/src/pages/Guidance.jsx): `frontend/src/pages/Guidance.jsx`
- [API client](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/frontend/src/api/client.js): `frontend/src/api/client.js`

### API workflows

- [FastAPI application](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/main.py): `backend/main.py`
- [Session endpoints](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/routers/sessions.py): `backend/routers/sessions.py`
- [Form endpoints](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/routers/forms.py): `backend/routers/forms.py`
- [Confirmation endpoints](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/routers/confirmations.py): `backend/routers/confirmations.py`
- [Fraud endpoints](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/routers/fraud.py): `backend/routers/fraud.py`
- [Scheme endpoints](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/routers/schemes.py): `backend/routers/schemes.py`
- [Guidance endpoints](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/routers/guidance.py): `backend/routers/guidance.py`

### Domain services

- [Form OCR](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/ocr_service.py): `backend/services/ocr_service.py`
- [Bank form detection](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/bank_form_service.py): `backend/services/bank_form_service.py`
- [Cheque processing](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/cheque_service.py): `backend/services/cheque_service.py`
- [Voice interpretation](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/voice_service.py): `backend/services/voice_service.py`
- [Document generation](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/pdf_service.py): `backend/services/pdf_service.py`
- [Challenge handling](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/nonce_service.py): `backend/services/nonce_service.py`
- [Fraud analysis](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/fraud_service.py): `backend/services/fraud_service.py`
- [Scam detection](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/scam_detector.py): `backend/services/scam_detector.py`
- [Message OCR](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/message_ocr.py): `backend/services/message_ocr.py`
- [Scheme matching](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/scheme_service.py): `backend/services/scheme_service.py`
- [Eligibility finder](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/scheme_finder.py): `backend/services/scheme_finder.py`
- [Scheme catalogue](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/schemes_data.py): `backend/services/schemes_data.py`
- [Guidance answers](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/guidance_service.py): `backend/services/guidance_service.py`
- [Finance knowledge base](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/services/finance_kb.py): `backend/services/finance_kb.py`

### Persistence

- [Database](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/database.py): `backend/database.py`
- [Domain records](https://github.com/nikhila-dhevi-r/finaccess-ai/blob/main/backend/models.py): `backend/models.py`

### Other components

- **User**

## Connections

- User → Application shell: uses
- Application shell → Form completion: routes to (evidence: `frontend/src/App.jsx`)
- Application shell → Fraud check: routes to (evidence: `frontend/src/App.jsx`)
- Application shell → Scheme discovery: routes to (evidence: `frontend/src/App.jsx`)
- Application shell → Financial guidance: routes to (evidence: `frontend/src/App.jsx`)
- Form completion → Speech interaction: uses (evidence: `frontend/src/pages/FormFill.jsx`)
- Form completion → API client: requests (evidence: `frontend/src/pages/FormFill.jsx`)
- Fraud check → API client: requests (evidence: `frontend/src/pages/FraudCheck.jsx`)
- Scheme discovery → API client: requests (evidence: `frontend/src/pages/Schemes.jsx`)
- Financial guidance → API client: requests (evidence: `frontend/src/pages/Guidance.jsx`)
- Form completion → Session and language: uses (evidence: `frontend/src/pages/FormFill.jsx`)
- Fraud check → Session and language: uses (evidence: `frontend/src/pages/FraudCheck.jsx`)
- Scheme discovery → Session and language: uses (evidence: `frontend/src/pages/Schemes.jsx`)
- Financial guidance → Session and language: uses (evidence: `frontend/src/pages/Guidance.jsx`)
- Session and language → API client: creates session (evidence: `frontend/src/hooks/useSession.js`)
- API client → FastAPI application: calls API
- FastAPI application → Session endpoints: registers (evidence: `backend/main.py`)
- FastAPI application → Form endpoints: registers (evidence: `backend/main.py`)
- FastAPI application → Confirmation endpoints: registers (evidence: `backend/main.py`)
- FastAPI application → Fraud endpoints: registers (evidence: `backend/main.py`)
- FastAPI application → Scheme endpoints: registers (evidence: `backend/main.py`)
- FastAPI application → Guidance endpoints: registers (evidence: `backend/main.py`)
- Session endpoints → Database: uses (evidence: `backend/routers/sessions.py`)
- Form endpoints → Form OCR: processes upload (evidence: `backend/routers/forms.py`)
- Form endpoints → Voice interpretation: interprets answers (evidence: `backend/routers/forms.py`)
- Form endpoints → Document generation: generates document (evidence: `backend/routers/forms.py`)
- Form endpoints → Challenge handling: requests challenge (evidence: `backend/routers/forms.py`)
- Form endpoints → Database: uses (evidence: `backend/routers/forms.py`)
- Confirmation endpoints → Challenge handling: validates challenge (evidence: `backend/routers/confirmations.py`)
- Confirmation endpoints → Database: uses (evidence: `backend/routers/confirmations.py`)
- Fraud endpoints → Fraud analysis: analyzes submission (evidence: `backend/routers/fraud.py`)
- Fraud endpoints → Database: uses (evidence: `backend/routers/fraud.py`)
- Fraud analysis → Scam detection: checks scam (evidence: `backend/services/fraud_service.py`)
- Fraud analysis → Message OCR: extracts message (evidence: `backend/services/fraud_service.py`)
- Fraud analysis → Cheque processing: checks cheque (evidence: `backend/services/fraud_service.py`)
- Scheme endpoints → Scheme matching: matches schemes (evidence: `backend/routers/schemes.py`)
- Scheme endpoints → Database: uses (evidence: `backend/routers/schemes.py`)
- Scheme matching → Eligibility finder: finds eligibility (evidence: `backend/services/scheme_service.py`)
- Scheme matching → Scheme catalogue: reads catalogue (evidence: `backend/services/scheme_service.py`)
- Eligibility finder → Scheme catalogue: matches catalogue (evidence: `backend/services/scheme_finder.py`)
- Guidance endpoints → Guidance answers: answers question (evidence: `backend/routers/guidance.py`)
- Guidance endpoints → Database: uses (evidence: `backend/routers/guidance.py`)
- Guidance answers → Finance knowledge base: searches knowledge (evidence: `backend/services/guidance_service.py`)
- Guidance answers → Scheme catalogue: references schemes (evidence: `backend/services/guidance_service.py`)
- Guidance answers → Eligibility finder: checks eligibility (evidence: `backend/services/guidance_service.py`)
- Database → Domain records: maps records (evidence: `backend/models.py`)
