# roysterc/call-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/roysterc/call-assistant
- Repository: https://github.com/roysterc/call-assistant

## Overview

DOAI Call Assistant is a multi-tenant salon CRM combining a booking diary and client records with Vapi- and in-house voice reception, WhatsApp, and embeddable website chat. Salon staff manage clients, appointments, settings, and conversations in the CRM; external channels handle customer interactions and feed the same operational records. The graph emphasizes those domain stages plus tenant access and persistence. Several routes and integrations are represented from the README and source index; unsampled implementation details and unverified links are omitted.

Main entry points: [`src/lib/booking/index.ts`](https://github.com/roysterc/call-assistant/blob/master/src/lib/booking/index.ts) (Booking provider), [`src/lib/tenant.ts`](https://github.com/roysterc/call-assistant/blob/master/src/lib/tenant.ts) (Tenant access), [`src/app/api/clients/route.ts`](https://github.com/roysterc/call-assistant/blob/master/src/app/api/clients/route.ts) (Client records), [`src/app/api/appointments/route.ts`](https://github.com/roysterc/call-assistant/blob/master/src/app/api/appointments/route.ts) (Appointment API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_crm["Salon CRM"]
  node_crm_ui["CRM workspace<br/>[page.tsx]"]
  node_client_records["Client records<br/>[route.ts]"]
  node_client_detail["Client detail<br/>[client-sheet.tsx]"]
  node_conversation_inbox["Conversation inbox<br/>[route.ts]"]
end

subgraph group_booking["Bookings"]
  node_appointment_api["Appointment API<br/>[route.ts]"]
  node_booking_provider["Booking provider<br/>[index.ts]"]
  node_booking_diary["Booking diary<br/>[diary.ts]"]
  node_booking_ui["Calendar UI<br/>[page.tsx]"]
  node_booking_engine["Availability rules<br/>[availability.ts]"]
end

subgraph group_channels["Customer channels"]
  node_vapi["Vapi receptionist<br/>[route.ts]"]
  node_receptionist_session["Receptionist session<br/>[session.ts]"]
  node_voice_booking["Voice booking<br/>[route.ts]"]
  node_voice_server["Live voice server<br/>[index.ts]"]
  node_whatsapp["WhatsApp webhook<br/>[route.ts]"]
  node_website_chat["Website chat<br/>[route.ts]"]
  node_widget["Embeddable widget<br/>[widget.js]"]
end

subgraph group_admin["Tenant setup"]
  node_salon_settings["Salon settings<br/>[route.ts]"]
  node_salon_config["Salon configuration<br/>[salon-config.ts]"]
end

subgraph group_foundation["Shared foundation"]
  node_tenant_access["Tenant access<br/>[tenant.ts]"]
  node_prisma[("PostgreSQL access<br/>[prisma.ts]")]
  node_claude["Claude assistant<br/>[claude.ts]"]
end

node_staff(("Salon staff"))

node_staff -->|"uses"| node_crm_ui
node_crm_ui -.->|"opens"| node_client_detail
node_client_detail -->|"loads and edits"| node_client_records
node_client_records -->|"authorizes"| node_tenant_access
node_client_records -->|"reads and writes"| node_prisma
node_appointment_api -->|"authorizes"| node_tenant_access
node_appointment_api -->|"resolves diary"| node_booking_provider
node_booking_provider -->|"uses availability"| node_booking_engine
node_booking_diary -->|"checks availability"| node_booking_engine
node_booking_ui -.->|"manages bookings"| node_appointment_api
node_vapi -->|"dispatches actions"| node_receptionist_session
node_voice_booking -->|"uses session"| node_receptionist_session
node_voice_booking -->|"resolves diary"| node_booking_provider
node_voice_server -->|"uses session"| node_receptionist_session
node_voice_server -->|"uses booking"| node_booking_provider
node_whatsapp -->|"generates replies"| node_claude
node_website_chat -->|"generates replies"| node_claude
node_widget -.->|"sends messages"| node_website_chat
node_salon_settings -->|"authorizes"| node_tenant_access
node_salon_settings -->|"parses configuration"| node_salon_config
node_booking_provider -->|"reads settings"| node_prisma
node_tenant_access -->|"checks membership"| node_prisma

click node_crm_ui "https://github.com/roysterc/call-assistant/blob/master/src/app/dashboard/page.tsx"
click node_client_records "https://github.com/roysterc/call-assistant/blob/master/src/app/api/clients/route.ts"
click node_client_detail "https://github.com/roysterc/call-assistant/blob/master/src/components/clients/client-sheet.tsx"
click node_conversation_inbox "https://github.com/roysterc/call-assistant/blob/master/src/app/api/conversations/route.ts"
click node_appointment_api "https://github.com/roysterc/call-assistant/blob/master/src/app/api/appointments/route.ts"
click node_booking_provider "https://github.com/roysterc/call-assistant/blob/master/src/lib/booking/index.ts"
click node_booking_diary "https://github.com/roysterc/call-assistant/blob/master/src/lib/booking/diary.ts"
click node_booking_ui "https://github.com/roysterc/call-assistant/blob/master/src/app/calendar/page.tsx"
click node_vapi "https://github.com/roysterc/call-assistant/blob/master/src/app/api/vapi/webhook/route.ts"
click node_receptionist_session "https://github.com/roysterc/call-assistant/blob/master/src/lib/receptionist/session.ts"
click node_voice_booking "https://github.com/roysterc/call-assistant/blob/master/src/app/api/voice-booking/route.ts"
click node_voice_server "https://github.com/roysterc/call-assistant/blob/master/src/voice-server/index.ts"
click node_whatsapp "https://github.com/roysterc/call-assistant/blob/master/src/app/api/whatsapp/webhook/route.ts"
click node_website_chat "https://github.com/roysterc/call-assistant/blob/master/src/app/api/website-chat/message/route.ts"
click node_widget "https://github.com/roysterc/call-assistant/blob/master/public/widget.js"
click node_salon_settings "https://github.com/roysterc/call-assistant/blob/master/src/app/api/settings/route.ts"
click node_salon_config "https://github.com/roysterc/call-assistant/blob/master/src/lib/salon-config.ts"
click node_tenant_access "https://github.com/roysterc/call-assistant/blob/master/src/lib/tenant.ts"
click node_prisma "https://github.com/roysterc/call-assistant/blob/master/src/lib/prisma.ts"
click node_claude "https://github.com/roysterc/call-assistant/blob/master/src/lib/claude.ts"
click node_booking_engine "https://github.com/roysterc/call-assistant/blob/master/src/lib/booking/availability.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_crm_ui,node_client_records,node_client_detail,node_conversation_inbox toneBlue
class node_appointment_api,node_booking_provider,node_booking_diary,node_booking_ui,node_booking_engine toneAmber
class node_vapi,node_receptionist_session,node_voice_booking,node_voice_server,node_whatsapp,node_website_chat,node_widget toneMint
class node_salon_settings,node_salon_config toneRose
class node_tenant_access,node_prisma,node_claude,node_staff toneIndigo
```

## Components

### Salon CRM

- [CRM workspace](https://github.com/roysterc/call-assistant/blob/master/src/app/dashboard/page.tsx): `src/app/dashboard/page.tsx`
- [Client records](https://github.com/roysterc/call-assistant/blob/master/src/app/api/clients/route.ts): `src/app/api/clients/route.ts`
- [Client detail](https://github.com/roysterc/call-assistant/blob/master/src/components/clients/client-sheet.tsx): `src/components/clients/client-sheet.tsx`
- [Conversation inbox](https://github.com/roysterc/call-assistant/blob/master/src/app/api/conversations/route.ts): `src/app/api/conversations/route.ts`

### Bookings

- [Appointment API](https://github.com/roysterc/call-assistant/blob/master/src/app/api/appointments/route.ts): `src/app/api/appointments/route.ts`
- [Booking provider](https://github.com/roysterc/call-assistant/blob/master/src/lib/booking/index.ts): `src/lib/booking/index.ts`
- [Booking diary](https://github.com/roysterc/call-assistant/blob/master/src/lib/booking/diary.ts): `src/lib/booking/diary.ts`
- [Calendar UI](https://github.com/roysterc/call-assistant/blob/master/src/app/calendar/page.tsx): `src/app/calendar/page.tsx`
- [Availability rules](https://github.com/roysterc/call-assistant/blob/master/src/lib/booking/availability.ts): `src/lib/booking/availability.ts`

### Customer channels

- [Vapi receptionist](https://github.com/roysterc/call-assistant/blob/master/src/app/api/vapi/webhook/route.ts): `src/app/api/vapi/webhook/route.ts`
- [Receptionist session](https://github.com/roysterc/call-assistant/blob/master/src/lib/receptionist/session.ts): `src/lib/receptionist/session.ts`
- [Voice booking](https://github.com/roysterc/call-assistant/blob/master/src/app/api/voice-booking/route.ts): `src/app/api/voice-booking/route.ts`
- [Live voice server](https://github.com/roysterc/call-assistant/blob/master/src/voice-server/index.ts): `src/voice-server/index.ts`
- [WhatsApp webhook](https://github.com/roysterc/call-assistant/blob/master/src/app/api/whatsapp/webhook/route.ts): `src/app/api/whatsapp/webhook/route.ts`
- [Website chat](https://github.com/roysterc/call-assistant/blob/master/src/app/api/website-chat/message/route.ts): `src/app/api/website-chat/message/route.ts`
- [Embeddable widget](https://github.com/roysterc/call-assistant/blob/master/public/widget.js): `public/widget.js`

### Tenant setup

- [Salon settings](https://github.com/roysterc/call-assistant/blob/master/src/app/api/settings/route.ts): `src/app/api/settings/route.ts`
- [Salon configuration](https://github.com/roysterc/call-assistant/blob/master/src/lib/salon-config.ts): `src/lib/salon-config.ts`

### Shared foundation

- [Tenant access](https://github.com/roysterc/call-assistant/blob/master/src/lib/tenant.ts): `src/lib/tenant.ts`
- [PostgreSQL access](https://github.com/roysterc/call-assistant/blob/master/src/lib/prisma.ts): `src/lib/prisma.ts`
- [Claude assistant](https://github.com/roysterc/call-assistant/blob/master/src/lib/claude.ts): `src/lib/claude.ts`

### Other components

- **Salon staff**

## Connections

- Salon staff → CRM workspace: uses
- CRM workspace → Client detail: opens
- Client detail → Client records: loads and edits (evidence: `src/components/clients/client-sheet.tsx`)
- Client records → Tenant access: authorizes (evidence: `src/app/api/clients/route.ts`)
- Client records → PostgreSQL access: reads and writes (evidence: `src/app/api/clients/route.ts`)
- Appointment API → Tenant access: authorizes (evidence: `src/app/api/appointments/route.ts`)
- Appointment API → Booking provider: resolves diary (evidence: `src/app/api/appointments/route.ts`)
- Booking provider → Availability rules: uses availability (evidence: `src/lib/booking/index.ts`)
- Booking diary → Availability rules: checks availability (evidence: `src/lib/booking/diary.ts`)
- Calendar UI → Appointment API: manages bookings
- Vapi receptionist → Receptionist session: dispatches actions (evidence: `src/lib/receptionist/session.ts`)
- Voice booking → Receptionist session: uses session (evidence: `src/app/api/voice-booking/route.ts`)
- Voice booking → Booking provider: resolves diary (evidence: `src/app/api/voice-booking/route.ts`)
- Live voice server → Receptionist session: uses session (evidence: `src/voice-server/index.ts`)
- Live voice server → Booking provider: uses booking (evidence: `src/voice-server/index.ts`)
- WhatsApp webhook → Claude assistant: generates replies (evidence: `src/app/api/whatsapp/webhook/route.ts`)
- Website chat → Claude assistant: generates replies (evidence: `src/app/api/website-chat/message/route.ts`)
- Embeddable widget → Website chat: sends messages
- Salon settings → Tenant access: authorizes (evidence: `src/app/api/settings/route.ts`)
- Salon settings → Salon configuration: parses configuration (evidence: `src/app/api/settings/route.ts`)
- Booking provider → PostgreSQL access: reads settings (evidence: `src/lib/booking/index.ts`)
- Tenant access → PostgreSQL access: checks membership (evidence: `src/lib/tenant.ts`)
