# heytarshitgupta/ai-khata-book architecture

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

- Interactive diagram: https://gitdiagram.com/heytarshitgupta/ai-khata-book
- Repository: https://github.com/heytarshitgupta/ai-khata-book

## Overview

AI Khata Book turns spoken Hindi transaction details into persisted ledger records: the user speaks through the browser, the server asks Gemini to extract transaction fields, then saves them in Supabase and returns a response for the interface. The README also describes a dashboard for viewing and managing transactions. The frontend source is not included in the sampled files, so its exact request and dashboard data wiring cannot be verified; those links are omitted.

Main entry points: [`server.js`](https://github.com/heytarshitgupta/ai-khata-book/blob/main/server.js) (Voice Endpoint), [`index.html`](https://github.com/heytarshitgupta/ai-khata-book/blob/main/index.html) (Speech Recognition)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Ledger Interface"]
  node_speech["Speech Recognition<br/>[index.html]"]
  node_dashboard["Transaction Dashboard<br/>[index.html]"]
end

subgraph group_service["Transaction Service"]
  node_endpoint["Voice Endpoint<br/>[server.js]"]
  node_extract["Field Extraction<br/>[server.js]"]
end

subgraph group_integrations["External Integrations"]
  node_gemini["Gemini"]
  node_supabase[("Supabase Ledger")]
end

node_user(("Ledger User"))

node_user -->|"speaks Hindi"| node_speech
node_speech -->|"submits text"| node_endpoint
node_endpoint -->|"requests extraction"| node_gemini
node_gemini -->|"returns fields"| node_extract
node_endpoint -->|"inserts transaction"| node_supabase
node_endpoint -->|"returns result"| node_dashboard
node_user -->|"views and manages"| node_dashboard

click node_speech "https://github.com/heytarshitgupta/ai-khata-book/blob/main/index.html"
click node_dashboard "https://github.com/heytarshitgupta/ai-khata-book/blob/main/index.html"
click node_endpoint "https://github.com/heytarshitgupta/ai-khata-book/blob/main/server.js"
click node_extract "https://github.com/heytarshitgupta/ai-khata-book/blob/main/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_speech,node_dashboard,node_user toneBlue
class node_endpoint,node_extract toneAmber
class node_gemini,node_supabase toneMint
```

## Components

### Ledger Interface

- [Speech Recognition](https://github.com/heytarshitgupta/ai-khata-book/blob/main/index.html): `index.html`
- [Transaction Dashboard](https://github.com/heytarshitgupta/ai-khata-book/blob/main/index.html): `index.html`

### Transaction Service

- [Voice Endpoint](https://github.com/heytarshitgupta/ai-khata-book/blob/main/server.js): `server.js`
- [Field Extraction](https://github.com/heytarshitgupta/ai-khata-book/blob/main/server.js): `server.js`

### External Integrations

- **Gemini**
- **Supabase Ledger**

### Other components

- **Ledger User**

## Connections

- Ledger User → Speech Recognition: speaks Hindi
- Speech Recognition → Voice Endpoint: submits text
- Voice Endpoint → Gemini: requests extraction
- Gemini → Field Extraction: returns fields
- Voice Endpoint → Supabase Ledger: inserts transaction
- Voice Endpoint → Transaction Dashboard: returns result
- Ledger User → Transaction Dashboard: views and manages
