# jaypathak-dev/voxlead-ai architecture

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

- Interactive diagram: https://gitdiagram.com/jaypathak-dev/voxlead-ai
- Repository: https://github.com/jaypathak-dev/voxlead-ai

## Overview

VoxLead AI is a local-first voice and chat sales agent with a React CRM. The principal workflow runs from the voice/text interface through the chat API and conversation orchestration, which combines local-model responses, grounded knowledge, contextual memory, qualification, sentiment, scoring, booking, and summaries; CRM and analytics expose the resulting persisted records. The README documents major capabilities, while several routes and services are unsampled, so links to those are limited to explicit documentation or indexed references.

Main entry points: [`backend/app/services/conversation_service.py`](https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/services/conversation_service.py) (Conversation orchestration), [`backend/app/api`](https://github.com/jaypathak-dev/voxlead-ai/tree/main/backend/app/api) (CRM API routes), [`backend/app/main.py`](https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/main.py) (FastAPI application), [`backend/app/database.py`](https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/database.py) (SQLite CRM store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Sales workspace"]
  node_voiceui["Voice and chat UI<br/>[VoiceAgent.tsx]"]
  node_speech["Browser speech I/O<br/>[useSpeech.ts]"]
  node_api_client["Frontend API client<br/>[api.ts]"]
  node_crm_ui["CRM dashboard<br/>[App.tsx]"]
end

subgraph group_api["API and orchestration"]
  node_main["FastAPI application<br/>[main.py]"]
  node_chat_api["Chat endpoint<br/>[chat.py]"]
  node_conversations["Conversation orchestration"]
end

subgraph group_intelligence["Conversation intelligence"]
  node_memory["Contextual memory<br/>[memory_service.py]"]
  node_rag["Knowledge retrieval<br/>[rag_service.py]"]
  node_embeddings["Local embeddings"]
  node_ollama["Local LLM<br/>[ollama_service.py]"]
  node_sentiment["Sentiment analysis"]
  node_scoring["Lead scoring<br/>[scoring_service.py]"]
end

subgraph group_crm["CRM workflows"]
  node_lead_service["Lead management<br/>[lead_service.py]"]
  node_booking["IST appointment booking<br/>[booking_service.py]"]
  node_summaries["Structured summaries<br/>[summary_service.py]"]
  node_crm_routes["CRM API routes"]
  node_analytics["Analytics API<br/>[analytics.py]"]
end

subgraph group_data["Local data and models"]
  node_database[("SQLite CRM store<br/>[database.py]")]
  node_models["CRM data models<br/>[models.py]"]
end

node_customer(("Prospect"))
node_ollama_service["Ollama inference service"]

node_customer -->|"speaks or types"| node_voiceui
node_voiceui -->|"uses speech I/O"| node_speech
node_voiceui -->|"sends requests"| node_api_client
node_crm_ui -->|"loads CRM data"| node_api_client
node_api_client -->|"calls REST API"| node_main
node_main -->|"registers router"| node_chat_api
node_chat_api -->|"handles chat"| node_conversations
node_conversations -->|"uses memory"| node_memory
node_conversations -->|"retrieves context"| node_rag
node_rag -->|"encodes chunks"| node_embeddings
node_conversations -->|"requests responses"| node_ollama
node_conversations -->|"analyzes sentiment"| node_sentiment
node_conversations -->|"scores lead"| node_scoring
node_conversations -->|"updates lead"| node_lead_service
node_conversations -->|"handles booking"| node_booking
node_conversations -->|"creates summary"| node_summaries
node_main -->|"registers routes"| node_crm_routes
node_crm_routes -->|"uses booking"| node_booking
node_crm_routes -->|"requests summary"| node_summaries
node_crm_routes -->|"manages knowledge"| node_rag
node_crm_routes -->|"queries records"| node_database
node_analytics -.->|"reports CRM metrics"| node_database
node_main -->|"registers router"| node_analytics
node_conversations -.->|"persists conversation"| node_database
node_database -->|"creates tables"| node_models
node_ollama -->|"uses local HTTP service"| node_ollama_service

click node_voiceui "https://github.com/jaypathak-dev/voxlead-ai/blob/main/frontend/src/pages/VoiceAgent.tsx"
click node_speech "https://github.com/jaypathak-dev/voxlead-ai/blob/main/frontend/src/hooks/useSpeech.ts"
click node_api_client "https://github.com/jaypathak-dev/voxlead-ai/blob/main/frontend/src/services/api.ts"
click node_crm_ui "https://github.com/jaypathak-dev/voxlead-ai/blob/main/frontend/src/App.tsx"
click node_main "https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/main.py"
click node_chat_api "https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/api/chat.py"
click node_conversations "https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/services/conversation_service.py"
click node_memory "https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/services/memory_service.py"
click node_rag "https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/services/rag_service.py"
click node_embeddings "https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/services/embedding_service.py"
click node_ollama "https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/services/ollama_service.py"
click node_sentiment "https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/services/sentiment_service.py"
click node_scoring "https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/services/scoring_service.py"
click node_lead_service "https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/services/lead_service.py"
click node_booking "https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/services/booking_service.py"
click node_summaries "https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/services/summary_service.py"
click node_crm_routes "https://github.com/jaypathak-dev/voxlead-ai/tree/main/backend/app/api"
click node_analytics "https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/api/analytics.py"
click node_database "https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/database.py"
click node_models "https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/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_voiceui,node_speech,node_api_client,node_crm_ui toneBlue
class node_main,node_chat_api,node_conversations toneAmber
class node_memory,node_rag,node_embeddings,node_ollama,node_sentiment,node_scoring toneMint
class node_lead_service,node_booking,node_summaries,node_crm_routes,node_analytics toneRose
class node_database,node_models,node_customer,node_ollama_service toneIndigo
```

## Components

### Sales workspace

- [Voice and chat UI](https://github.com/jaypathak-dev/voxlead-ai/blob/main/frontend/src/pages/VoiceAgent.tsx): `frontend/src/pages/VoiceAgent.tsx`
- [Browser speech I/O](https://github.com/jaypathak-dev/voxlead-ai/blob/main/frontend/src/hooks/useSpeech.ts): `frontend/src/hooks/useSpeech.ts`
- [Frontend API client](https://github.com/jaypathak-dev/voxlead-ai/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [CRM dashboard](https://github.com/jaypathak-dev/voxlead-ai/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`

### API and orchestration

- [FastAPI application](https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/main.py): `backend/app/main.py`
- [Chat endpoint](https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/api/chat.py): `backend/app/api/chat.py`
- [Conversation orchestration](https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/services/conversation_service.py): `backend/app/services/conversation_service.py`

### Conversation intelligence

- [Contextual memory](https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/services/memory_service.py): `backend/app/services/memory_service.py`
- [Knowledge retrieval](https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/services/rag_service.py): `backend/app/services/rag_service.py`
- [Local embeddings](https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/services/embedding_service.py): `backend/app/services/embedding_service.py`
- [Local LLM](https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/services/ollama_service.py): `backend/app/services/ollama_service.py`
- [Sentiment analysis](https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/services/sentiment_service.py): `backend/app/services/sentiment_service.py`
- [Lead scoring](https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/services/scoring_service.py): `backend/app/services/scoring_service.py`

### CRM workflows

- [Lead management](https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/services/lead_service.py): `backend/app/services/lead_service.py`
- [IST appointment booking](https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/services/booking_service.py): `backend/app/services/booking_service.py`
- [Structured summaries](https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/services/summary_service.py): `backend/app/services/summary_service.py`
- [CRM API routes](https://github.com/jaypathak-dev/voxlead-ai/tree/main/backend/app/api): `backend/app/api`
- [Analytics API](https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/api/analytics.py): `backend/app/api/analytics.py`

### Local data and models

- [SQLite CRM store](https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/database.py): `backend/app/database.py`
- [CRM data models](https://github.com/jaypathak-dev/voxlead-ai/blob/main/backend/app/models.py): `backend/app/models.py`

### Other components

- **Prospect**
- **Ollama inference service**

## Connections

- Prospect → Voice and chat UI: speaks or types
- Voice and chat UI → Browser speech I/O: uses speech I/O (evidence: `frontend/src/pages/VoiceAgent.tsx`)
- Voice and chat UI → Frontend API client: sends requests (evidence: `frontend/src/pages/VoiceAgent.tsx`)
- CRM dashboard → Frontend API client: loads CRM data (evidence: `frontend/src/App.tsx`)
- Frontend API client → FastAPI application: calls REST API
- FastAPI application → Chat endpoint: registers router (evidence: `backend/app/main.py`)
- Chat endpoint → Conversation orchestration: handles chat (evidence: `backend/app/services/conversation_service.py`)
- Conversation orchestration → Contextual memory: uses memory (evidence: `backend/app/services/conversation_service.py`)
- Conversation orchestration → Knowledge retrieval: retrieves context (evidence: `backend/app/services/conversation_service.py`)
- Knowledge retrieval → Local embeddings: encodes chunks (evidence: `backend/app/services/rag_service.py`)
- Conversation orchestration → Local LLM: requests responses (evidence: `backend/app/services/conversation_service.py`)
- Conversation orchestration → Sentiment analysis: analyzes sentiment (evidence: `backend/app/services/conversation_service.py`)
- Conversation orchestration → Lead scoring: scores lead (evidence: `backend/app/services/conversation_service.py`)
- Conversation orchestration → Lead management: updates lead (evidence: `backend/app/services/conversation_service.py`)
- Conversation orchestration → IST appointment booking: handles booking (evidence: `backend/app/services/conversation_service.py`)
- Conversation orchestration → Structured summaries: creates summary (evidence: `backend/app/services/conversation_service.py`)
- FastAPI application → CRM API routes: registers routes (evidence: `backend/app/main.py`)
- CRM API routes → IST appointment booking: uses booking (evidence: `backend/app/api/appointments.py`)
- CRM API routes → Structured summaries: requests summary (evidence: `backend/app/api/conversations.py`)
- CRM API routes → Knowledge retrieval: manages knowledge (evidence: `backend/app/api/knowledge.py`)
- CRM API routes → SQLite CRM store: queries records (evidence: `backend/app/api/leads.py`)
- Analytics API → SQLite CRM store: reports CRM metrics
- FastAPI application → Analytics API: registers router (evidence: `backend/app/main.py`)
- Conversation orchestration → SQLite CRM store: persists conversation
- SQLite CRM store → CRM data models: creates tables (evidence: `backend/app/database.py`)
- Local LLM → Ollama inference service: uses local HTTP service
