# imkumar80/enry-bol architecture

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

- Interactive diagram: https://gitdiagram.com/imkumar80/enry-bol
- Repository: https://github.com/imkumar80/enry-bol

## Overview

Enry Voice OS turns shopkeepers’ multilingual speech into retail actions: browser audio reaches the voice gateway, turn management detects speech boundaries and handles interruptions, ASR produces a transcript, the agent selects or confirms an action, and the response is streamed back as speech. Retail actions cover billing, inventory, customer credit and payments, and daily summaries. The dashboard also exposes REST-backed customer, inventory, transaction, and checkout views. The README documents these capabilities; some links for unsampled modules rely on that documentation and the project structure.

Main entry points: [`db.py`](https://github.com/imkumar80/enry-bol/blob/main/db.py) (SQLite Store), [`voice/turn_manager.py`](https://github.com/imkumar80/enry-bol/blob/main/voice/turn_manager.py) (Turn Manager), [`static/app.js`](https://github.com/imkumar80/enry-bol/blob/main/static/app.js) (Browser Client), [`voice/gateway.py`](https://github.com/imkumar80/enry-bol/blob/main/voice/gateway.py) (Voice Gateway)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Shopkeeper Client"]
  node_dashboard["Dashboard UI<br/>[index.html]"]
  node_browser["Browser Client<br/>[app.js]"]
end

subgraph group_voice["Voice Pipeline"]
  node_api["FastAPI API<br/>[app.py]"]
  node_gateway["Voice Gateway<br/>[gateway.py]"]
  node_turns["Turn Manager<br/>[turn_manager.py]"]
  node_vad["Speech Detection<br/>[vad.py]"]
  node_asr["Streaming ASR<br/>[asr.py]"]
  node_tts["TTS Provider<br/>[cartesia.py]"]
end

subgraph group_agent["Agent Actions"]
  node_agentgraph["ReAct Agent<br/>[graph.py]"]
  node_llm["LLM Adapter<br/>[llm.py]"]
  node_tools["Retail Action Tools<br/>[tools.py]"]
end

subgraph group_data["Retail Data"]
  node_db[("SQLite Store<br/>[db.py]")]
  node_inventory["Inventory<br/>[db.py]"]
  node_billing["Bills &amp; Checkout<br/>[db.py]"]
  node_khata["Customer Ledger<br/>[db.py]"]
  node_summaries["Daily Summaries<br/>[db.py]"]
end

node_shopkeeper(("Shopkeeper"))
node_deepgram["Deepgram ASR"]
node_gemini["Gemini"]
node_cartesia["Cartesia TTS"]

node_shopkeeper -->|"uses"| node_browser
node_browser -->|"renders"| node_dashboard
node_browser -->|"streams audio"| node_gateway
node_gateway -->|"routes events"| node_turns
node_turns -->|"checks audio"| node_vad
node_turns -->|"sends speech"| node_asr
node_asr -->|"transcribes"| node_deepgram
node_turns -->|"processes transcript"| node_agentgraph
node_agentgraph -->|"requests decisions"| node_llm
node_llm -->|"queries"| node_gemini
node_agentgraph -->|"dispatches actions"| node_tools
node_tools -->|"reads and writes"| node_db
node_turns -->|"speaks response"| node_tts
node_tts -->|"generates audio"| node_cartesia
node_tts -->|"streams audio"| node_gateway
node_gateway -->|"sends events"| node_browser
node_browser -->|"requests REST data"| node_api
node_api -->|"reads and writes"| node_db
node_db -->|"stores"| node_inventory
node_db -->|"stores"| node_billing
node_db -->|"stores"| node_khata
node_db -->|"provides totals"| node_summaries

click node_dashboard "https://github.com/imkumar80/enry-bol/blob/main/static/index.html"
click node_browser "https://github.com/imkumar80/enry-bol/blob/main/static/app.js"
click node_api "https://github.com/imkumar80/enry-bol/blob/main/app.py"
click node_gateway "https://github.com/imkumar80/enry-bol/blob/main/voice/gateway.py"
click node_turns "https://github.com/imkumar80/enry-bol/blob/main/voice/turn_manager.py"
click node_vad "https://github.com/imkumar80/enry-bol/blob/main/voice/vad.py"
click node_asr "https://github.com/imkumar80/enry-bol/blob/main/voice/asr.py"
click node_agentgraph "https://github.com/imkumar80/enry-bol/blob/main/agent/graph.py"
click node_llm "https://github.com/imkumar80/enry-bol/blob/main/agent/llm.py"
click node_tools "https://github.com/imkumar80/enry-bol/blob/main/agent/tools.py"
click node_tts "https://github.com/imkumar80/enry-bol/blob/main/tts/cartesia.py"
click node_db "https://github.com/imkumar80/enry-bol/blob/main/db.py"
click node_inventory "https://github.com/imkumar80/enry-bol/blob/main/db.py"
click node_billing "https://github.com/imkumar80/enry-bol/blob/main/db.py"
click node_khata "https://github.com/imkumar80/enry-bol/blob/main/db.py"
click node_summaries "https://github.com/imkumar80/enry-bol/blob/main/db.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_dashboard,node_browser toneBlue
class node_api,node_gateway,node_turns,node_vad,node_asr,node_tts toneAmber
class node_agentgraph,node_llm,node_tools toneMint
class node_db,node_inventory,node_billing,node_khata,node_summaries toneRose
class node_shopkeeper,node_deepgram,node_gemini,node_cartesia toneIndigo
```

## Components

### Shopkeeper Client

- [Dashboard UI](https://github.com/imkumar80/enry-bol/blob/main/static/index.html): `static/index.html`
- [Browser Client](https://github.com/imkumar80/enry-bol/blob/main/static/app.js): `static/app.js`

### Voice Pipeline

- [FastAPI API](https://github.com/imkumar80/enry-bol/blob/main/app.py): `app.py`
- [Voice Gateway](https://github.com/imkumar80/enry-bol/blob/main/voice/gateway.py): `voice/gateway.py`
- [Turn Manager](https://github.com/imkumar80/enry-bol/blob/main/voice/turn_manager.py): `voice/turn_manager.py`
- [Speech Detection](https://github.com/imkumar80/enry-bol/blob/main/voice/vad.py): `voice/vad.py`
- [Streaming ASR](https://github.com/imkumar80/enry-bol/blob/main/voice/asr.py): `voice/asr.py`
- [TTS Provider](https://github.com/imkumar80/enry-bol/blob/main/tts/cartesia.py): `tts/cartesia.py`

### Agent Actions

- [ReAct Agent](https://github.com/imkumar80/enry-bol/blob/main/agent/graph.py): `agent/graph.py`
- [LLM Adapter](https://github.com/imkumar80/enry-bol/blob/main/agent/llm.py): `agent/llm.py`
- [Retail Action Tools](https://github.com/imkumar80/enry-bol/blob/main/agent/tools.py): `agent/tools.py`

### Retail Data

- [SQLite Store](https://github.com/imkumar80/enry-bol/blob/main/db.py): `db.py`
- [Inventory](https://github.com/imkumar80/enry-bol/blob/main/db.py): `db.py`
- [Bills & Checkout](https://github.com/imkumar80/enry-bol/blob/main/db.py): `db.py`
- [Customer Ledger](https://github.com/imkumar80/enry-bol/blob/main/db.py): `db.py`
- [Daily Summaries](https://github.com/imkumar80/enry-bol/blob/main/db.py): `db.py`

### Other components

- **Shopkeeper**
- **Deepgram ASR**
- **Gemini**
- **Cartesia TTS**

## Connections

- Shopkeeper → Browser Client: uses
- Browser Client → Dashboard UI: renders
- Browser Client → Voice Gateway: streams audio
- Voice Gateway → Turn Manager: routes events
- Turn Manager → Speech Detection: checks audio
- Turn Manager → Streaming ASR: sends speech
- Streaming ASR → Deepgram ASR: transcribes
- Turn Manager → ReAct Agent: processes transcript
- ReAct Agent → LLM Adapter: requests decisions
- LLM Adapter → Gemini: queries
- ReAct Agent → Retail Action Tools: dispatches actions
- Retail Action Tools → SQLite Store: reads and writes
- Turn Manager → TTS Provider: speaks response
- TTS Provider → Cartesia TTS: generates audio
- TTS Provider → Voice Gateway: streams audio
- Voice Gateway → Browser Client: sends events
- Browser Client → FastAPI API: requests REST data
- FastAPI API → SQLite Store: reads and writes
- SQLite Store → Inventory: stores
- SQLite Store → Bills & Checkout: stores
- SQLite Store → Customer Ledger: stores
- SQLite Store → Daily Summaries: provides totals
