# ddm700/callcenteria-ddm architecture

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

- Interactive diagram: https://gitdiagram.com/ddm700/callcenteria-ddm
- Repository: https://github.com/ddm700/callcenteria-ddm

## Overview

Callcenter IA is a campaign-driven AI calling and collections operations dashboard. Operators create campaigns, manage/import contacts, dispatch calls, and review call records, quality, agreements/KPIs, reports, settings, and logs. The frontend has both a Supabase-facing service layer and HTTP API calls; the repository also contains two backend implementations, one focused on general call operations and another on queued VAPI campaign imports/dispatch. Edges are limited to explicit route wiring, indexed references, and shown calls; several page-level and backend internals were not sampled.

Main entry points: [`App.tsx`](https://github.com/ddm700/callcenteria-ddm/blob/hugo/App.tsx) (Dashboard router), [`services/supabaseService.ts`](https://github.com/ddm700/callcenteria-ddm/blob/hugo/services/supabaseService.ts) (Supabase data service), [`backend/src/lib/supabase.ts`](https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend/src/lib/supabase.ts) (Admin database client), [`backend/src/app.ts`](https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend/src/app.ts) (Express route registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Operator interface"]
  node_app["Dashboard router<br/>[App.tsx]"]
  node_campaigns["Campaign management<br/>[Campaigns.tsx]"]
  node_contacts["Contact management<br/>[Contacts.tsx]"]
  node_calls["Call history<br/>[Calls.tsx]"]
  node_callmodal["Call details"]
  node_quality["Quality review<br/>[Quality.tsx]"]
  node_reports["Reports<br/>[Reports.tsx]"]
  node_kpis["Agreement KPIs<br/>[KpiAcordos.tsx]"]
  node_settings["Settings<br/>[Settings.tsx]"]
  node_logs["System logs<br/>[Logs.tsx]"]
  node_uisystem["UI components<br/>[ui.tsx]"]
end

subgraph group_frontend["Frontend services"]
  node_supabase_service["Supabase data service<br/>[supabaseService.ts]"]
  node_api_service["API service<br/>[api.ts]"]
  node_vapi_service["VAPI service<br/>[vapiService.ts]"]
  node_log_service["Log service<br/>[logService.ts]"]
  node_http_client["HTTP client<br/>[apiClient.ts]"]
  node_supabase_client["Supabase client<br/>[supabaseClient.ts]"]
end

subgraph group_backend["Call operations API"]
  node_express_app["Express route registry<br/>[app.ts]"]
  node_call_routes["Call routes<br/>[calls.ts]"]
  node_campaign_routes["Campaign routes<br/>[campaigns.ts]"]
  node_contact_routes["Contact routes<br/>[contacts.ts]"]
  node_vapi_routes["VAPI routes<br/>[vapi.ts]"]
  node_webhook_routes["Webhook routes<br/>[webhooks.ts]"]
  node_call_dispatch["Call dispatch service<br/>[callDispatch.ts]"]
  node_backend_supabase["Admin database client<br/>[supabase.ts]"]
end

subgraph group_dispatch["VAPI campaign dispatch"]
  node_vapi_api["VAPI campaign API<br/>[routes.ts]"]
  node_xlsx["Spreadsheet parser<br/>[excel.ts]"]
  node_campaign_repo["Campaign repository<br/>[repo.ts]"]
  node_queue["Dispatch queue<br/>[queue.ts]"]
  node_vapi_integration["VAPI integration<br/>[vapi.ts]"]
  node_worker["Queue worker<br/>[worker.ts]"]
end

node_operator(("Operator"))
node_db[("Supabase data store")]
node_vapi_db[("Dispatch database")]

node_operator -->|"uses"| node_app
node_app -->|"routes to"| node_campaigns
node_app -->|"routes to"| node_contacts
node_app -->|"routes to"| node_calls
node_app -->|"routes to"| node_reports
node_app -->|"routes to"| node_kpis
node_app -->|"routes to"| node_quality
node_app -->|"routes to"| node_settings
node_app -->|"routes to"| node_logs
node_calls -->|"opens details"| node_callmodal
node_campaigns -->|"uses"| node_supabase_service
node_contacts -->|"uses"| node_supabase_service
node_calls -->|"uses"| node_supabase_service
node_quality -->|"uses"| node_supabase_service
node_campaigns -->|"uses"| node_vapi_service
node_campaigns -->|"uses"| node_api_service
node_contacts -->|"uses"| node_api_service
node_supabase_service -->|"queries"| node_supabase_client
node_supabase_service -->|"requests"| node_http_client
node_log_service -->|"reads and writes"| node_supabase_client
node_api_service -->|"requests"| node_http_client
node_vapi_service -->|"requests"| node_http_client
node_supabase_client -->|"connects"| node_db
node_express_app -->|"mounts"| node_call_routes
node_express_app -->|"mounts"| node_campaign_routes
node_express_app -->|"mounts"| node_contact_routes
node_express_app -->|"mounts"| node_vapi_routes
node_express_app -->|"mounts"| node_webhook_routes
node_call_routes -->|"calls"| node_call_dispatch
node_campaign_routes -->|"calls"| node_call_dispatch
node_call_routes -->|"queries"| node_backend_supabase
node_campaign_routes -->|"queries"| node_backend_supabase
node_contact_routes -->|"queries"| node_backend_supabase
node_vapi_routes -->|"queries"| node_backend_supabase
node_webhook_routes -->|"writes"| node_backend_supabase
node_backend_supabase -->|"connects"| node_db
node_vapi_api -->|"parses imports"| node_xlsx
node_vapi_api -->|"manages records"| node_campaign_repo
node_vapi_api -->|"enqueues calls"| node_queue
node_vapi_api -->|"lists resources"| node_vapi_integration
node_worker -->|"consumes"| node_queue
node_worker -->|"updates records"| node_campaign_repo
node_campaign_repo -.->|"persists"| node_vapi_db

click node_app "https://github.com/ddm700/callcenteria-ddm/blob/hugo/App.tsx"
click node_campaigns "https://github.com/ddm700/callcenteria-ddm/blob/hugo/pages/Campaigns.tsx"
click node_contacts "https://github.com/ddm700/callcenteria-ddm/blob/hugo/pages/Contacts.tsx"
click node_calls "https://github.com/ddm700/callcenteria-ddm/blob/hugo/pages/Calls.tsx"
click node_callmodal "https://github.com/ddm700/callcenteria-ddm/blob/hugo/components/CallDetailsModal.tsx"
click node_quality "https://github.com/ddm700/callcenteria-ddm/blob/hugo/pages/Quality.tsx"
click node_reports "https://github.com/ddm700/callcenteria-ddm/blob/hugo/pages/Reports.tsx"
click node_kpis "https://github.com/ddm700/callcenteria-ddm/blob/hugo/pages/KpiAcordos.tsx"
click node_settings "https://github.com/ddm700/callcenteria-ddm/blob/hugo/pages/Settings.tsx"
click node_logs "https://github.com/ddm700/callcenteria-ddm/blob/hugo/pages/Logs.tsx"
click node_uisystem "https://github.com/ddm700/callcenteria-ddm/blob/hugo/components/ui.tsx"
click node_supabase_service "https://github.com/ddm700/callcenteria-ddm/blob/hugo/services/supabaseService.ts"
click node_api_service "https://github.com/ddm700/callcenteria-ddm/blob/hugo/services/api.ts"
click node_vapi_service "https://github.com/ddm700/callcenteria-ddm/blob/hugo/services/vapiService.ts"
click node_log_service "https://github.com/ddm700/callcenteria-ddm/blob/hugo/services/logService.ts"
click node_http_client "https://github.com/ddm700/callcenteria-ddm/blob/hugo/lib/apiClient.ts"
click node_supabase_client "https://github.com/ddm700/callcenteria-ddm/blob/hugo/lib/supabaseClient.ts"
click node_express_app "https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend/src/app.ts"
click node_call_routes "https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend/src/routes/calls.ts"
click node_campaign_routes "https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend/src/routes/campaigns.ts"
click node_contact_routes "https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend/src/routes/contacts.ts"
click node_vapi_routes "https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend/src/routes/vapi.ts"
click node_webhook_routes "https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend/src/routes/webhooks.ts"
click node_call_dispatch "https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend/src/services/callDispatch.ts"
click node_backend_supabase "https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend/src/lib/supabase.ts"
click node_vapi_api "https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend_vapi/src/routes.ts"
click node_xlsx "https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend_vapi/src/utils/excel.ts"
click node_campaign_repo "https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend_vapi/src/repo.ts"
click node_queue "https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend_vapi/src/queue.ts"
click node_vapi_integration "https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend_vapi/src/vapi.ts"
click node_worker "https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend_vapi/src/worker.ts"

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_campaigns,node_contacts,node_calls,node_callmodal,node_quality,node_reports,node_kpis,node_settings,node_logs,node_uisystem toneBlue
class node_supabase_service,node_api_service,node_vapi_service,node_log_service,node_http_client,node_supabase_client,node_db,node_vapi_db toneAmber
class node_express_app,node_call_routes,node_campaign_routes,node_contact_routes,node_vapi_routes,node_webhook_routes,node_call_dispatch,node_backend_supabase toneMint
class node_vapi_api,node_xlsx,node_campaign_repo,node_queue,node_vapi_integration,node_worker toneRose
class node_operator toneIndigo
```

## Components

### Operator interface

- [Dashboard router](https://github.com/ddm700/callcenteria-ddm/blob/hugo/App.tsx): `App.tsx`
- [Campaign management](https://github.com/ddm700/callcenteria-ddm/blob/hugo/pages/Campaigns.tsx): `pages/Campaigns.tsx`
- [Contact management](https://github.com/ddm700/callcenteria-ddm/blob/hugo/pages/Contacts.tsx): `pages/Contacts.tsx`
- [Call history](https://github.com/ddm700/callcenteria-ddm/blob/hugo/pages/Calls.tsx): `pages/Calls.tsx`
- [Call details](https://github.com/ddm700/callcenteria-ddm/blob/hugo/components/CallDetailsModal.tsx): `components/CallDetailsModal.tsx`
- [Quality review](https://github.com/ddm700/callcenteria-ddm/blob/hugo/pages/Quality.tsx): `pages/Quality.tsx`
- [Reports](https://github.com/ddm700/callcenteria-ddm/blob/hugo/pages/Reports.tsx): `pages/Reports.tsx`
- [Agreement KPIs](https://github.com/ddm700/callcenteria-ddm/blob/hugo/pages/KpiAcordos.tsx): `pages/KpiAcordos.tsx`
- [Settings](https://github.com/ddm700/callcenteria-ddm/blob/hugo/pages/Settings.tsx): `pages/Settings.tsx`
- [System logs](https://github.com/ddm700/callcenteria-ddm/blob/hugo/pages/Logs.tsx): `pages/Logs.tsx`
- [UI components](https://github.com/ddm700/callcenteria-ddm/blob/hugo/components/ui.tsx): `components/ui.tsx`

### Frontend services

- [Supabase data service](https://github.com/ddm700/callcenteria-ddm/blob/hugo/services/supabaseService.ts): `services/supabaseService.ts`
- [API service](https://github.com/ddm700/callcenteria-ddm/blob/hugo/services/api.ts): `services/api.ts`
- [VAPI service](https://github.com/ddm700/callcenteria-ddm/blob/hugo/services/vapiService.ts): `services/vapiService.ts`
- [Log service](https://github.com/ddm700/callcenteria-ddm/blob/hugo/services/logService.ts): `services/logService.ts`
- [HTTP client](https://github.com/ddm700/callcenteria-ddm/blob/hugo/lib/apiClient.ts): `lib/apiClient.ts`
- [Supabase client](https://github.com/ddm700/callcenteria-ddm/blob/hugo/lib/supabaseClient.ts): `lib/supabaseClient.ts`

### Call operations API

- [Express route registry](https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend/src/app.ts): `backend/src/app.ts`
- [Call routes](https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend/src/routes/calls.ts): `backend/src/routes/calls.ts`
- [Campaign routes](https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend/src/routes/campaigns.ts): `backend/src/routes/campaigns.ts`
- [Contact routes](https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend/src/routes/contacts.ts): `backend/src/routes/contacts.ts`
- [VAPI routes](https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend/src/routes/vapi.ts): `backend/src/routes/vapi.ts`
- [Webhook routes](https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend/src/routes/webhooks.ts): `backend/src/routes/webhooks.ts`
- [Call dispatch service](https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend/src/services/callDispatch.ts): `backend/src/services/callDispatch.ts`
- [Admin database client](https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend/src/lib/supabase.ts): `backend/src/lib/supabase.ts`

### VAPI campaign dispatch

- [VAPI campaign API](https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend_vapi/src/routes.ts): `backend_vapi/src/routes.ts`
- [Spreadsheet parser](https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend_vapi/src/utils/excel.ts): `backend_vapi/src/utils/excel.ts`
- [Campaign repository](https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend_vapi/src/repo.ts): `backend_vapi/src/repo.ts`
- [Dispatch queue](https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend_vapi/src/queue.ts): `backend_vapi/src/queue.ts`
- [VAPI integration](https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend_vapi/src/vapi.ts): `backend_vapi/src/vapi.ts`
- [Queue worker](https://github.com/ddm700/callcenteria-ddm/blob/hugo/backend_vapi/src/worker.ts): `backend_vapi/src/worker.ts`

### Other components

- **Operator**
- **Supabase data store**
- **Dispatch database**

## Connections

- Operator → Dashboard router: uses (evidence: `App.tsx`)
- Dashboard router → Campaign management: routes to (evidence: `App.tsx`)
- Dashboard router → Contact management: routes to (evidence: `App.tsx`)
- Dashboard router → Call history: routes to (evidence: `App.tsx`)
- Dashboard router → Reports: routes to (evidence: `App.tsx`)
- Dashboard router → Agreement KPIs: routes to (evidence: `App.tsx`)
- Dashboard router → Quality review: routes to (evidence: `App.tsx`)
- Dashboard router → Settings: routes to (evidence: `App.tsx`)
- Dashboard router → System logs: routes to (evidence: `App.tsx`)
- Call history → Call details: opens details (evidence: `pages/Calls.tsx`)
- Campaign management → Supabase data service: uses (evidence: `pages/Campaigns.tsx`)
- Contact management → Supabase data service: uses (evidence: `pages/Contacts.tsx`)
- Call history → Supabase data service: uses (evidence: `pages/Calls.tsx`)
- Quality review → Supabase data service: uses (evidence: `pages/Quality.tsx`)
- Campaign management → VAPI service: uses (evidence: `pages/Campaigns.tsx`)
- Campaign management → API service: uses (evidence: `pages/Campaigns.tsx`)
- Contact management → API service: uses (evidence: `pages/Contacts.tsx`)
- Supabase data service → Supabase client: queries (evidence: `services/supabaseService.ts`)
- Supabase data service → HTTP client: requests (evidence: `services/supabaseService.ts`)
- Log service → Supabase client: reads and writes (evidence: `services/logService.ts`)
- API service → HTTP client: requests (evidence: `services/api.ts`)
- VAPI service → HTTP client: requests (evidence: `services/vapiService.ts`)
- Supabase client → Supabase data store: connects (evidence: `lib/supabaseClient.ts`)
- Express route registry → Call routes: mounts (evidence: `backend/src/app.ts`)
- Express route registry → Campaign routes: mounts (evidence: `backend/src/app.ts`)
- Express route registry → Contact routes: mounts (evidence: `backend/src/app.ts`)
- Express route registry → VAPI routes: mounts (evidence: `backend/src/app.ts`)
- Express route registry → Webhook routes: mounts (evidence: `backend/src/app.ts`)
- Call routes → Call dispatch service: calls (evidence: `backend/src/routes/calls.ts`)
- Campaign routes → Call dispatch service: calls (evidence: `backend/src/routes/campaigns.ts`)
- Call routes → Admin database client: queries (evidence: `backend/src/routes/calls.ts`)
- Campaign routes → Admin database client: queries (evidence: `backend/src/routes/campaigns.ts`)
- Contact routes → Admin database client: queries (evidence: `backend/src/routes/contacts.ts`)
- VAPI routes → Admin database client: queries (evidence: `backend/src/routes/vapi.ts`)
- Webhook routes → Admin database client: writes (evidence: `backend/src/routes/webhooks.ts`)
- Admin database client → Supabase data store: connects (evidence: `backend/src/lib/supabase.ts`)
- VAPI campaign API → Spreadsheet parser: parses imports (evidence: `backend_vapi/src/routes.ts`)
- VAPI campaign API → Campaign repository: manages records (evidence: `backend_vapi/src/routes.ts`)
- VAPI campaign API → Dispatch queue: enqueues calls (evidence: `backend_vapi/src/routes.ts`)
- VAPI campaign API → VAPI integration: lists resources (evidence: `backend_vapi/src/routes.ts`)
- Queue worker → Dispatch queue: consumes (evidence: `backend_vapi/src/worker.ts`)
- Queue worker → Campaign repository: updates records (evidence: `backend_vapi/src/worker.ts`)
- Campaign repository → Dispatch database: persists
