# shanmugamsanzz/zea-voice architecture

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

- Interactive diagram: https://gitdiagram.com/shanmugamsanzz/zea-voice
- Repository: https://github.com/shanmugamsanzz/zea-voice

## Overview

Zea Voice is a multi-tenant voice-agent platform with a web dashboard and a backend for live calls, agent configuration, campaigns, and account operations. The primary runtime path is an inbound Plivo webhook into call handling and voice orchestration, which coordinates conversation logic and provider/audio components. The README also documents tenant-isolated Qdrant retrieval and an embedding service. Several product areas are represented by their source directories because their implementations were not sampled; links to them are omitted where the evidence does not establish runtime calls.

Main entry points: [`Backend/src/telephony/plivo-webhook.routes.js`](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/telephony/plivo-webhook.routes.js) (Plivo webhook), [`Backend/src/voice/voice.routes.js`](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/voice/voice.routes.js) (Voice runtime), [`Backend/src/voice/interaction/template-engine-production-runtime.js`](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/voice/interaction/template-engine-production-runtime.js) (Turn workflow), [`Backend/src/voice/call-ownership.service.js`](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/voice/call-ownership.service.js) (Call ownership)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Dashboard"]
  node_frontend["Web application<br/>[App.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_company_views["Company views<br/>[CompanyViews.tsx]"]
end

subgraph group_voice["Voice runtime"]
  node_plivo_webhook["Plivo webhook"]
  node_webhook_service["Webhook handling"]
  node_answer_service["Call answer"]
  node_voice_runtime["Voice runtime<br/>[voice.routes.js]"]
  node_orchestrator["Conversation orchestration"]
  node_template_runtime["Turn workflow"]
  node_provider_config["Provider configuration<br/>[provider-config.js]"]
  node_provider_registry["Provider registry<br/>[registry.js]"]
  node_audio_engine["Audio processing<br/>[audio-engine.js]"]
  node_call_ownership["Call ownership"]
  node_inbound_queue["Inbound queue"]
end

subgraph group_agents["Agent capabilities"]
  node_agent_services["Agent configuration<br/>[agent.service.js]"]
  node_knowledge_retrieval["Knowledge retrieval"]
end

subgraph group_operations["Business operations"]
  node_campaigns["Campaign execution"]
  node_conversations["Conversation records"]
  node_followup["Follow-up dispatch"]
  node_billing["Credits and usage"]
  node_analytics["Insights and reports<br/>[insight.service.js]"]
end

subgraph group_platform["Platform services"]
  node_backend_api["Backend API<br/>[app.js]"]
  node_db_context["Tenant DB context"]
  node_database[("PostgreSQL<br/>[database.js]")]
  node_redis[("Redis<br/>[redis.js]")]
end

node_caller(("Caller"))
node_plivo{{"Plivo telephony"}}
node_embedding_service{{"Embedding service"}}
node_qdrant[("Qdrant<br/>[qdrant.client.js]")]

node_frontend -->|"renders"| node_company_views
node_frontend -->|"uses"| node_api_client
node_api_client -->|"requests"| node_backend_api
node_caller -.->|"calls"| node_plivo
node_plivo -->|"routes webhook"| node_plivo_webhook
node_plivo_webhook -->|"dispatches"| node_webhook_service
node_plivo_webhook -->|"dispatches"| node_answer_service
node_plivo_webhook -->|"checks ownership"| node_call_ownership
node_plivo_webhook -->|"queues calls"| node_inbound_queue
node_voice_runtime -->|"uses"| node_answer_service
node_voice_runtime -->|"checks ownership"| node_call_ownership
node_voice_runtime -->|"queues calls"| node_inbound_queue
node_voice_runtime -->|"loads configuration"| node_provider_config
node_voice_runtime -->|"selects providers"| node_provider_registry
node_orchestrator -.->|"runs turns"| node_template_runtime
node_template_runtime -->|"retrieves context"| node_knowledge_retrieval
node_template_runtime -.->|"invokes model"| node_provider_registry
node_audio_engine -->|"uses formats"| node_provider_config
node_plivo_webhook -->|"dispatches follow-ups"| node_followup
node_followup -->|"queries tenant data"| node_db_context
node_db_context -->|"runs transactions"| node_database
node_call_ownership -->|"stores ownership"| node_redis
node_inbound_queue -->|"manages queue"| node_redis
node_embedding_service -.->|"supplies vectors"| node_qdrant

click node_frontend "https://github.com/shanmugamsanzz/zea-voice/blob/main/Frontend/src/App.tsx"
click node_api_client "https://github.com/shanmugamsanzz/zea-voice/blob/main/Frontend/src/lib/api.ts"
click node_company_views "https://github.com/shanmugamsanzz/zea-voice/blob/main/Frontend/src/components/views/CompanyViews.tsx"
click node_backend_api "https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/app.js"
click node_plivo_webhook "https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/telephony/plivo-webhook.routes.js"
click node_webhook_service "https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/telephony/plivo-webhook.service.js"
click node_answer_service "https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/voice/plivo-answer.service.js"
click node_voice_runtime "https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/voice/voice.routes.js"
click node_orchestrator "https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/voice/realtime-conversation-orchestrator.js"
click node_template_runtime "https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/voice/interaction/template-engine-production-runtime.js"
click node_provider_config "https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/voice/providers/provider-config.js"
click node_provider_registry "https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/voice/providers/registry.js"
click node_audio_engine "https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/voice/audio/audio-engine.js"
click node_call_ownership "https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/voice/call-ownership.service.js"
click node_inbound_queue "https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/voice/inbound-call-queue.service.js"
click node_agent_services "https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/agents/agent.service.js"
click node_knowledge_retrieval "https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/voice/interaction/agent-qdrant-retrieval.js"
click node_campaigns "https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/campaigns/campaign-execution.service.js"
click node_conversations "https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/calls/conversation-thread.service.js"
click node_followup "https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/calls/follow-up-dispatch.service.js"
click node_billing "https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/credits/usage-price-calculation.service.js"
click node_analytics "https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/insights/insight.service.js"
click node_db_context "https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/infrastructure/database-context.js"
click node_database "https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/infrastructure/database.js"
click node_redis "https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/infrastructure/redis.js"
click node_qdrant "https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/rag/qdrant.client.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_frontend,node_api_client,node_company_views toneBlue
class node_plivo_webhook,node_webhook_service,node_answer_service,node_voice_runtime,node_orchestrator,node_template_runtime,node_provider_config,node_provider_registry,node_audio_engine,node_call_ownership,node_inbound_queue,node_qdrant toneAmber
class node_agent_services,node_knowledge_retrieval toneMint
class node_campaigns,node_conversations,node_followup,node_billing,node_analytics toneRose
class node_backend_api,node_db_context,node_database,node_redis,node_caller,node_plivo,node_embedding_service toneIndigo
```

## Components

### Dashboard

- [Web application](https://github.com/shanmugamsanzz/zea-voice/blob/main/Frontend/src/App.tsx): `Frontend/src/App.tsx`
- [API client](https://github.com/shanmugamsanzz/zea-voice/blob/main/Frontend/src/lib/api.ts): `Frontend/src/lib/api.ts`
- [Company views](https://github.com/shanmugamsanzz/zea-voice/blob/main/Frontend/src/components/views/CompanyViews.tsx): `Frontend/src/components/views/CompanyViews.tsx`

### Voice runtime

- [Plivo webhook](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/telephony/plivo-webhook.routes.js): `Backend/src/telephony/plivo-webhook.routes.js`
- [Webhook handling](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/telephony/plivo-webhook.service.js): `Backend/src/telephony/plivo-webhook.service.js`
- [Call answer](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/voice/plivo-answer.service.js): `Backend/src/voice/plivo-answer.service.js`
- [Voice runtime](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/voice/voice.routes.js): `Backend/src/voice/voice.routes.js`
- [Conversation orchestration](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/voice/realtime-conversation-orchestrator.js): `Backend/src/voice/realtime-conversation-orchestrator.js`
- [Turn workflow](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/voice/interaction/template-engine-production-runtime.js): `Backend/src/voice/interaction/template-engine-production-runtime.js`
- [Provider configuration](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/voice/providers/provider-config.js): `Backend/src/voice/providers/provider-config.js`
- [Provider registry](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/voice/providers/registry.js): `Backend/src/voice/providers/registry.js`
- [Audio processing](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/voice/audio/audio-engine.js): `Backend/src/voice/audio/audio-engine.js`
- [Call ownership](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/voice/call-ownership.service.js): `Backend/src/voice/call-ownership.service.js`
- [Inbound queue](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/voice/inbound-call-queue.service.js): `Backend/src/voice/inbound-call-queue.service.js`

### Agent capabilities

- [Agent configuration](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/agents/agent.service.js): `Backend/src/agents/agent.service.js`
- [Knowledge retrieval](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/voice/interaction/agent-qdrant-retrieval.js): `Backend/src/voice/interaction/agent-qdrant-retrieval.js`

### Business operations

- [Campaign execution](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/campaigns/campaign-execution.service.js): `Backend/src/campaigns/campaign-execution.service.js`
- [Conversation records](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/calls/conversation-thread.service.js): `Backend/src/calls/conversation-thread.service.js`
- [Follow-up dispatch](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/calls/follow-up-dispatch.service.js): `Backend/src/calls/follow-up-dispatch.service.js`
- [Credits and usage](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/credits/usage-price-calculation.service.js): `Backend/src/credits/usage-price-calculation.service.js`
- [Insights and reports](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/insights/insight.service.js): `Backend/src/insights/insight.service.js`

### Platform services

- [Backend API](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/app.js): `Backend/src/app.js`
- [Tenant DB context](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/infrastructure/database-context.js): `Backend/src/infrastructure/database-context.js`
- [PostgreSQL](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/infrastructure/database.js): `Backend/src/infrastructure/database.js`
- [Redis](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/infrastructure/redis.js): `Backend/src/infrastructure/redis.js`

### Other components

- **Caller**
- **Plivo telephony**
- **Embedding service**
- [Qdrant](https://github.com/shanmugamsanzz/zea-voice/blob/main/Backend/src/rag/qdrant.client.js): `Backend/src/rag/qdrant.client.js`

## Connections

- Web application → Company views: renders (evidence: `Frontend/src/App.tsx`)
- Web application → API client: uses (evidence: `Frontend/src/App.tsx`)
- API client → Backend API: requests (evidence: `Frontend/src/lib/api.ts`)
- Caller → Plivo telephony: calls
- Plivo telephony → Plivo webhook: routes webhook (evidence: `README.md`)
- Plivo webhook → Webhook handling: dispatches (evidence: `Backend/src/telephony/plivo-webhook.routes.js`)
- Plivo webhook → Call answer: dispatches (evidence: `Backend/src/telephony/plivo-webhook.routes.js`)
- Plivo webhook → Call ownership: checks ownership (evidence: `Backend/src/telephony/plivo-webhook.routes.js`)
- Plivo webhook → Inbound queue: queues calls (evidence: `Backend/src/telephony/plivo-webhook.routes.js`)
- Voice runtime → Call answer: uses (evidence: `Backend/src/voice/voice.routes.js`)
- Voice runtime → Call ownership: checks ownership (evidence: `Backend/src/voice/voice.routes.js`)
- Voice runtime → Inbound queue: queues calls (evidence: `Backend/src/voice/voice.routes.js`)
- Voice runtime → Provider configuration: loads configuration (evidence: `Backend/src/voice/voice.routes.js`)
- Voice runtime → Provider registry: selects providers (evidence: `Backend/src/voice/voice.routes.js`)
- Conversation orchestration → Turn workflow: runs turns
- Turn workflow → Knowledge retrieval: retrieves context (evidence: `Backend/src/voice/interaction/template-engine-production-runtime.js`)
- Turn workflow → Provider registry: invokes model
- Audio processing → Provider configuration: uses formats (evidence: `Backend/src/voice/audio/audio-engine.js`)
- Plivo webhook → Follow-up dispatch: dispatches follow-ups (evidence: `Backend/src/telephony/plivo-webhook.routes.js`)
- Follow-up dispatch → Tenant DB context: queries tenant data (evidence: `Backend/src/calls/follow-up-dispatch.service.js`)
- Tenant DB context → PostgreSQL: runs transactions (evidence: `Backend/src/infrastructure/database-context.js`)
- Call ownership → Redis: stores ownership (evidence: `Backend/src/voice/call-ownership.service.js`)
- Inbound queue → Redis: manages queue (evidence: `Backend/src/voice/inbound-call-queue.service.js`)
- Embedding service → Qdrant: supplies vectors (evidence: `README.md`)
