# shanmugamsanzz/zvoice-legacy architecture

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

- Interactive diagram: https://gitdiagram.com/shanmugamsanzz/zvoice-legacy
- Repository: https://github.com/shanmugamsanzz/zvoice-legacy

## Overview

Zea Voice is a multi-tenant voice-agent platform with a web dashboard and backend API. Users authenticate, enter role-specific dashboards, and manage agents, knowledge, campaigns, calls, and administrative resources. A central product path is configuring an agent and its knowledge, then using the voice runtime to handle calls; the excerpts establish the agent, knowledge, and audio/provider layers, but do not show the complete call-dispatch path. The README documents PostgreSQL, Redis, an embedding service, and Qdrant isolation. Some major product areas are included from the source tree; uncertain runtime links are omitted.

Main entry points: [`Frontend/src/App.tsx`](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Frontend/src/App.tsx) (App shell), [`Backend/src/voice/realtime-conversation-orchestrator.js`](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/voice/realtime-conversation-orchestrator.js) (Voice runtime), [`Backend/src/agents/agent-runtime.service.js`](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/agents/agent-runtime.service.js) (Agent runtime config), [`Backend/src/knowledge-bases/knowledge-runtime.service.js`](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/knowledge-bases/knowledge-runtime.service.js) (Knowledge runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Dashboard"]
  node_app["App shell<br/>[App.tsx]"]
  node_layouts["Dashboard layouts"]
  node_company_views["Company views<br/>[CompanyViews.tsx]"]
  node_admin_views["Super-admin views"]
  node_api_client["API client<br/>[api.ts]"]
  node_query_cache["Query cache<br/>[queryClient.ts]"]
end

subgraph group_identity["Identity and tenancy"]
  node_auth_routes["Authentication routes<br/>[auth.routes.js]"]
  node_auth_service["Authentication service<br/>[auth.service.js]"]
  node_auth_middleware["Auth middleware<br/>[auth.middleware.js]"]
  node_tenant_middleware["Tenant context"]
end

subgraph group_agent_knowledge["Agents and knowledge"]
  node_agent_routes["Agent resource routes"]
  node_agent_runtime["Agent runtime config"]
  node_agent_knowledge["Agent knowledge links"]
  node_knowledge_runtime["Knowledge runtime"]
  node_knowledge_review["Knowledge review"]
  node_knowledge_queue["Processing queue"]
end

subgraph group_voice_campaigns["Voice and campaigns"]
  node_campaign_routes["Campaign routes<br/>[campaign.routes.js]"]
  node_campaign_service["Campaign management"]
  node_campaign_tasks["Campaign tasks"]
  node_voice_runtime["Voice runtime"]
  node_voice_audio["Audio engine<br/>[audio-engine.js]"]
  node_llm_response["LLM response service"]
  node_telephony["Telephony service"]
end

subgraph group_platform["Platform services"]
  node_database_context["Database context"]
  node_postgres[("PostgreSQL")]
  node_embedding["Embedding client"]
  node_qdrant[("Qdrant")]
  node_redis[("Redis")]
end

node_user(("Platform user"))

node_user -.->|"uses"| node_app
node_app -->|"renders"| node_layouts
node_app -->|"renders"| node_company_views
node_app -->|"renders"| node_admin_views
node_app -->|"checks session"| node_api_client
node_api_client -->|"uses"| node_query_cache
node_auth_routes -.->|"delegates"| node_auth_service
node_auth_middleware -->|"authenticates"| node_auth_service
node_tenant_middleware -->|"sets tenant context"| node_database_context
node_agent_routes -->|"delegates"| node_agent_knowledge
node_agent_routes -->|"delegates"| node_agent_runtime
node_agent_knowledge -->|"uses"| node_knowledge_runtime
node_agent_runtime -->|"uses"| node_knowledge_runtime
node_knowledge_review -->|"enqueues"| node_knowledge_queue
node_campaign_routes -->|"delegates"| node_campaign_service
node_campaign_routes -->|"delegates"| node_campaign_tasks
node_voice_runtime -.->|"uses"| node_voice_audio
node_voice_runtime -.->|"requests responses"| node_llm_response
node_voice_runtime -.->|"handles calls"| node_telephony
node_llm_response -->|"loads agent config"| node_agent_runtime
node_database_context -->|"runs transactions"| node_postgres
node_embedding -.->|"indexes vectors"| node_qdrant
node_knowledge_runtime -.->|"retrieves embeddings"| node_embedding
node_campaign_tasks -.->|"dispatches work"| node_redis

click node_app "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Frontend/src/App.tsx"
click node_layouts "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Frontend/src/components/layouts/DashboardLayouts.tsx"
click node_company_views "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Frontend/src/components/views/CompanyViews.tsx"
click node_admin_views "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Frontend/src/components/views/SuperAdminViews.tsx"
click node_api_client "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Frontend/src/lib/api.ts"
click node_query_cache "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Frontend/src/lib/queryClient.ts"
click node_auth_routes "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/auth/auth.routes.js"
click node_auth_service "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/auth/auth.service.js"
click node_auth_middleware "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/auth/auth.middleware.js"
click node_tenant_middleware "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/auth/tenant.middleware.js"
click node_agent_routes "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/agents/agent-resource.routes.js"
click node_agent_runtime "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/agents/agent-runtime.service.js"
click node_agent_knowledge "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/agents/agent-knowledge-base.service.js"
click node_knowledge_runtime "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/knowledge-bases/knowledge-runtime.service.js"
click node_knowledge_review "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/knowledge-bases/knowledge-review.service.js"
click node_knowledge_queue "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/knowledge-bases/knowledge-processing.queue.js"
click node_campaign_routes "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/campaigns/campaign.routes.js"
click node_campaign_service "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/campaigns/campaign.service.js"
click node_campaign_tasks "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/campaigns/campaign-task.service.js"
click node_voice_runtime "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/voice/realtime-conversation-orchestrator.js"
click node_voice_audio "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/voice/audio/audio-engine.js"
click node_llm_response "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/voice/providers/llm/llm-response.service.js"
click node_telephony "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/telephony/telephony.service.js"
click node_database_context "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/infrastructure/database-context.js"
click node_embedding "https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/rag/embedding.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_app,node_layouts,node_company_views,node_admin_views,node_api_client,node_query_cache,node_user toneBlue
class node_auth_routes,node_auth_service,node_auth_middleware,node_tenant_middleware toneAmber
class node_agent_routes,node_agent_runtime,node_agent_knowledge,node_knowledge_runtime,node_knowledge_review,node_knowledge_queue toneMint
class node_campaign_routes,node_campaign_service,node_campaign_tasks,node_voice_runtime,node_voice_audio,node_llm_response,node_telephony toneRose
class node_database_context,node_postgres,node_embedding,node_qdrant,node_redis toneIndigo
```

## Components

### Dashboard

- [App shell](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Frontend/src/App.tsx): `Frontend/src/App.tsx`
- [Dashboard layouts](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Frontend/src/components/layouts/DashboardLayouts.tsx): `Frontend/src/components/layouts/DashboardLayouts.tsx`
- [Company views](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Frontend/src/components/views/CompanyViews.tsx): `Frontend/src/components/views/CompanyViews.tsx`
- [Super-admin views](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Frontend/src/components/views/SuperAdminViews.tsx): `Frontend/src/components/views/SuperAdminViews.tsx`
- [API client](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Frontend/src/lib/api.ts): `Frontend/src/lib/api.ts`
- [Query cache](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Frontend/src/lib/queryClient.ts): `Frontend/src/lib/queryClient.ts`

### Identity and tenancy

- [Authentication routes](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/auth/auth.routes.js): `Backend/src/auth/auth.routes.js`
- [Authentication service](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/auth/auth.service.js): `Backend/src/auth/auth.service.js`
- [Auth middleware](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/auth/auth.middleware.js): `Backend/src/auth/auth.middleware.js`
- [Tenant context](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/auth/tenant.middleware.js): `Backend/src/auth/tenant.middleware.js`

### Agents and knowledge

- [Agent resource routes](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/agents/agent-resource.routes.js): `Backend/src/agents/agent-resource.routes.js`
- [Agent runtime config](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/agents/agent-runtime.service.js): `Backend/src/agents/agent-runtime.service.js`
- [Agent knowledge links](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/agents/agent-knowledge-base.service.js): `Backend/src/agents/agent-knowledge-base.service.js`
- [Knowledge runtime](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/knowledge-bases/knowledge-runtime.service.js): `Backend/src/knowledge-bases/knowledge-runtime.service.js`
- [Knowledge review](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/knowledge-bases/knowledge-review.service.js): `Backend/src/knowledge-bases/knowledge-review.service.js`
- [Processing queue](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/knowledge-bases/knowledge-processing.queue.js): `Backend/src/knowledge-bases/knowledge-processing.queue.js`

### Voice and campaigns

- [Campaign routes](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/campaigns/campaign.routes.js): `Backend/src/campaigns/campaign.routes.js`
- [Campaign management](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/campaigns/campaign.service.js): `Backend/src/campaigns/campaign.service.js`
- [Campaign tasks](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/campaigns/campaign-task.service.js): `Backend/src/campaigns/campaign-task.service.js`
- [Voice runtime](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/voice/realtime-conversation-orchestrator.js): `Backend/src/voice/realtime-conversation-orchestrator.js`
- [Audio engine](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/voice/audio/audio-engine.js): `Backend/src/voice/audio/audio-engine.js`
- [LLM response service](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/voice/providers/llm/llm-response.service.js): `Backend/src/voice/providers/llm/llm-response.service.js`
- [Telephony service](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/telephony/telephony.service.js): `Backend/src/telephony/telephony.service.js`

### Platform services

- [Database context](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/infrastructure/database-context.js): `Backend/src/infrastructure/database-context.js`
- **PostgreSQL**
- [Embedding client](https://github.com/shanmugamsanzz/zvoice-legacy/blob/main/Backend/src/rag/embedding.client.js): `Backend/src/rag/embedding.client.js`
- **Qdrant**
- **Redis**

### Other components

- **Platform user**

## Connections

- Platform user → App shell: uses
- App shell → Dashboard layouts: renders (evidence: `Frontend/src/App.tsx`)
- App shell → Company views: renders (evidence: `Frontend/src/App.tsx`)
- App shell → Super-admin views: renders (evidence: `Frontend/src/App.tsx`)
- App shell → API client: checks session (evidence: `Frontend/src/App.tsx`)
- API client → Query cache: uses (evidence: `Frontend/src/lib/api.ts`)
- Authentication routes → Authentication service: delegates
- Auth middleware → Authentication service: authenticates (evidence: `Backend/src/auth/auth.middleware.js`)
- Tenant context → Database context: sets tenant context (evidence: `Backend/src/auth/tenant.middleware.js`)
- Agent resource routes → Agent knowledge links: delegates (evidence: `Backend/src/agents/agent-resource.routes.js`)
- Agent resource routes → Agent runtime config: delegates (evidence: `Backend/src/agents/agent-resource.routes.js`)
- Agent knowledge links → Knowledge runtime: uses (evidence: `Backend/src/agents/agent-knowledge-base.service.js`)
- Agent runtime config → Knowledge runtime: uses (evidence: `Backend/src/agents/agent-runtime.service.js`)
- Knowledge review → Processing queue: enqueues (evidence: `Backend/src/knowledge-bases/knowledge-review.service.js`)
- Campaign routes → Campaign management: delegates (evidence: `Backend/src/campaigns/campaign.routes.js`)
- Campaign routes → Campaign tasks: delegates (evidence: `Backend/src/campaigns/campaign.routes.js`)
- Voice runtime → Audio engine: uses
- Voice runtime → LLM response service: requests responses
- Voice runtime → Telephony service: handles calls
- LLM response service → Agent runtime config: loads agent config (evidence: `Backend/src/voice/providers/llm/llm-response.service.js`)
- Database context → PostgreSQL: runs transactions (evidence: `Backend/src/infrastructure/database-context.js`)
- Embedding client → Qdrant: indexes vectors
- Knowledge runtime → Embedding client: retrieves embeddings
- Campaign tasks → Redis: dispatches work
