# ashutosh-kumar-rao/chat-cue architecture

> Architecture diagram of the GitHub repository ashutosh-kumar-rao/chat-cue, 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/ashutosh-kumar-rao/chat-cue
- Repository: https://github.com/ashutosh-kumar-rao/chat-cue

## Overview

Chat-Cue combines an organization-facing support dashboard with an embedded customer widget and Convex backend. Its documented core workflow is businesses managing knowledge files, then customers asking questions that the AI answers with retrieved context and tracks as conversations. The sampled code confirms the embed-to-widget launch and contact-session creation, plus RAG configuration, but not the full file-ingestion or AI-answer call chain. Dashed links mark documented capabilities whose implementation wiring was not sampled.

Main entry points: [`apps/web/modules/dashboard/ui`](https://github.com/ashutosh-kumar-rao/chat-cue/tree/main/apps/web/modules/dashboard/ui) (Admin dashboard), [`apps/widget/modules/widget/ui`](https://github.com/ashutosh-kumar-rao/chat-cue/tree/main/apps/widget/modules/widget/ui) (Customer widget), [`packages/backend/convex/system/ai/agents/supportAgent.ts`](https://github.com/ashutosh-kumar-rao/chat-cue/blob/main/packages/backend/convex/system/ai/agents/supportAgent.ts) (Support agent), [`packages/backend/convex/public/messages.ts`](https://github.com/ashutosh-kumar-rao/chat-cue/blob/main/packages/backend/convex/public/messages.ts) (Messages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_business["Business Console"]
  node_auth["Sign-in and org setup"]
  node_dashboard["Admin dashboard"]
  node_files["Knowledge files"]
  node_customize["Widget settings"]
  node_billing["Plans and billing"]
  node_integrations["Integrations"]
  node_vapi_console["Voice integration"]
end

subgraph group_customer["Customer Channels"]
  node_embed["Website embed<br/>[embed.ts]"]
  node_widget["Customer widget"]
end

subgraph group_backend["Support Backend"]
  node_convex_api["Convex API"]
  node_sessions["Contact sessions<br/>[contactSessions.ts]"]
  node_conversations["Conversation management<br/>[conversations.ts]"]
  node_messages["Messages<br/>[messages.ts]"]
  node_schema[("Application data<br/>[schema.ts]")]
  node_private_files["File processing<br/>[files.ts]"]
end

subgraph group_intelligence["AI Knowledge"]
  node_rag["RAG retrieval<br/>[rag.ts]"]
  node_agent["Support agent<br/>[supportAgent.ts]"]
  node_search["Knowledge search<br/>[search.ts]"]
  node_resolution["Resolve or escalate"]
end

node_business_user(("Business user"))
node_customer(("Customer"))
node_vapi{{"VAPI voice service"}}
node_clerk{{"Clerk identity and billing"}}

node_business_user -.->|"signs in"| node_auth
node_auth -.->|"authenticates"| node_clerk
node_business_user -.->|"manages support"| node_dashboard
node_dashboard -.->|"opens knowledge"| node_files
node_dashboard -.->|"configures widget"| node_customize
node_dashboard -.->|"manages plan"| node_billing
node_dashboard -.->|"connects tools"| node_integrations
node_dashboard -.->|"configures voice"| node_vapi_console
node_business_user -.->|"installs script"| node_embed
node_embed -->|"loads iframe"| node_widget
node_customer -.->|"starts support"| node_widget
node_widget -->|"creates session"| node_sessions
node_sessions -->|"writes session"| node_schema
node_widget -->|"uses backend API"| node_convex_api
node_dashboard -->|"queries and mutates"| node_convex_api
node_files -.->|"uploads documents"| node_private_files
node_private_files -.->|"indexes content"| node_rag
node_widget -.->|"sends questions"| node_messages
node_agent -.->|"retrieves context"| node_search
node_search -.->|"searches vectors"| node_rag
node_agent -.->|"produces response"| node_messages
node_agent -.->|"classifies outcome"| node_resolution
node_conversations -.->|"tracks state"| node_schema
node_messages -.->|"stores messages"| node_schema
node_vapi_console -.->|"connects voice"| node_vapi
node_widget -.->|"supports voice calls"| node_vapi
node_billing -.->|"uses billing"| node_clerk

click node_auth "https://github.com/ashutosh-kumar-rao/chat-cue/tree/main/apps/web/modules/auth/ui"
click node_dashboard "https://github.com/ashutosh-kumar-rao/chat-cue/tree/main/apps/web/modules/dashboard/ui"
click node_files "https://github.com/ashutosh-kumar-rao/chat-cue/tree/main/apps/web/modules/files/ui"
click node_customize "https://github.com/ashutosh-kumar-rao/chat-cue/tree/main/apps/web/modules/customization/ui"
click node_billing "https://github.com/ashutosh-kumar-rao/chat-cue/tree/main/apps/web/modules/billing/ui"
click node_integrations "https://github.com/ashutosh-kumar-rao/chat-cue/tree/main/apps/web/modules/integrations/ui"
click node_vapi_console "https://github.com/ashutosh-kumar-rao/chat-cue/tree/main/apps/web/modules/plugin/ui"
click node_embed "https://github.com/ashutosh-kumar-rao/chat-cue/blob/main/apps/embed/embed.ts"
click node_widget "https://github.com/ashutosh-kumar-rao/chat-cue/tree/main/apps/widget/modules/widget/ui"
click node_convex_api "https://github.com/ashutosh-kumar-rao/chat-cue/tree/main/packages/backend/convex/public"
click node_sessions "https://github.com/ashutosh-kumar-rao/chat-cue/blob/main/packages/backend/convex/public/contactSessions.ts"
click node_conversations "https://github.com/ashutosh-kumar-rao/chat-cue/blob/main/packages/backend/convex/public/conversations.ts"
click node_messages "https://github.com/ashutosh-kumar-rao/chat-cue/blob/main/packages/backend/convex/public/messages.ts"
click node_schema "https://github.com/ashutosh-kumar-rao/chat-cue/blob/main/packages/backend/convex/schema.ts"
click node_private_files "https://github.com/ashutosh-kumar-rao/chat-cue/blob/main/packages/backend/convex/private/files.ts"
click node_rag "https://github.com/ashutosh-kumar-rao/chat-cue/blob/main/packages/backend/convex/system/ai/rag.ts"
click node_agent "https://github.com/ashutosh-kumar-rao/chat-cue/blob/main/packages/backend/convex/system/ai/agents/supportAgent.ts"
click node_search "https://github.com/ashutosh-kumar-rao/chat-cue/blob/main/packages/backend/convex/system/ai/tools/search.ts"
click node_resolution "https://github.com/ashutosh-kumar-rao/chat-cue/tree/main/packages/backend/convex/system/ai/tools"

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_auth,node_dashboard,node_files,node_customize,node_billing,node_integrations,node_vapi_console,node_business_user toneBlue
class node_embed,node_widget toneAmber
class node_convex_api,node_sessions,node_conversations,node_messages,node_schema,node_private_files,node_vapi toneMint
class node_rag,node_agent,node_search,node_resolution toneRose
class node_customer,node_clerk toneIndigo
```

## Components

### Business Console

- [Sign-in and org setup](https://github.com/ashutosh-kumar-rao/chat-cue/tree/main/apps/web/modules/auth/ui): `apps/web/modules/auth/ui`
- [Admin dashboard](https://github.com/ashutosh-kumar-rao/chat-cue/tree/main/apps/web/modules/dashboard/ui): `apps/web/modules/dashboard/ui`
- [Knowledge files](https://github.com/ashutosh-kumar-rao/chat-cue/tree/main/apps/web/modules/files/ui): `apps/web/modules/files/ui`
- [Widget settings](https://github.com/ashutosh-kumar-rao/chat-cue/tree/main/apps/web/modules/customization/ui): `apps/web/modules/customization/ui`
- [Plans and billing](https://github.com/ashutosh-kumar-rao/chat-cue/tree/main/apps/web/modules/billing/ui): `apps/web/modules/billing/ui`
- [Integrations](https://github.com/ashutosh-kumar-rao/chat-cue/tree/main/apps/web/modules/integrations/ui): `apps/web/modules/integrations/ui`
- [Voice integration](https://github.com/ashutosh-kumar-rao/chat-cue/tree/main/apps/web/modules/plugin/ui): `apps/web/modules/plugin/ui`

### Customer Channels

- [Website embed](https://github.com/ashutosh-kumar-rao/chat-cue/blob/main/apps/embed/embed.ts): `apps/embed/embed.ts`
- [Customer widget](https://github.com/ashutosh-kumar-rao/chat-cue/tree/main/apps/widget/modules/widget/ui): `apps/widget/modules/widget/ui`

### Support Backend

- [Convex API](https://github.com/ashutosh-kumar-rao/chat-cue/tree/main/packages/backend/convex/public): `packages/backend/convex/public`
- [Contact sessions](https://github.com/ashutosh-kumar-rao/chat-cue/blob/main/packages/backend/convex/public/contactSessions.ts): `packages/backend/convex/public/contactSessions.ts`
- [Conversation management](https://github.com/ashutosh-kumar-rao/chat-cue/blob/main/packages/backend/convex/public/conversations.ts): `packages/backend/convex/public/conversations.ts`
- [Messages](https://github.com/ashutosh-kumar-rao/chat-cue/blob/main/packages/backend/convex/public/messages.ts): `packages/backend/convex/public/messages.ts`
- [Application data](https://github.com/ashutosh-kumar-rao/chat-cue/blob/main/packages/backend/convex/schema.ts): `packages/backend/convex/schema.ts`
- [File processing](https://github.com/ashutosh-kumar-rao/chat-cue/blob/main/packages/backend/convex/private/files.ts): `packages/backend/convex/private/files.ts`

### AI Knowledge

- [RAG retrieval](https://github.com/ashutosh-kumar-rao/chat-cue/blob/main/packages/backend/convex/system/ai/rag.ts): `packages/backend/convex/system/ai/rag.ts`
- [Support agent](https://github.com/ashutosh-kumar-rao/chat-cue/blob/main/packages/backend/convex/system/ai/agents/supportAgent.ts): `packages/backend/convex/system/ai/agents/supportAgent.ts`
- [Knowledge search](https://github.com/ashutosh-kumar-rao/chat-cue/blob/main/packages/backend/convex/system/ai/tools/search.ts): `packages/backend/convex/system/ai/tools/search.ts`
- [Resolve or escalate](https://github.com/ashutosh-kumar-rao/chat-cue/tree/main/packages/backend/convex/system/ai/tools): `packages/backend/convex/system/ai/tools`

### Other components

- **Business user**
- **Customer**
- **VAPI voice service**
- **Clerk identity and billing**

## Connections

- Business user → Sign-in and org setup: signs in
- Sign-in and org setup → Clerk identity and billing: authenticates
- Business user → Admin dashboard: manages support
- Admin dashboard → Knowledge files: opens knowledge
- Admin dashboard → Widget settings: configures widget
- Admin dashboard → Plans and billing: manages plan
- Admin dashboard → Integrations: connects tools
- Admin dashboard → Voice integration: configures voice
- Business user → Website embed: installs script
- Website embed → Customer widget: loads iframe (evidence: `apps/embed/embed.ts`)
- Customer → Customer widget: starts support
- Customer widget → Contact sessions: creates session (evidence: `apps/widget/modules/widget/ui/screens/widget-auth-screen.tsx`)
- Contact sessions → Application data: writes session (evidence: `packages/backend/convex/public/contactSessions.ts`)
- Customer widget → Convex API: uses backend API (evidence: `apps/widget/modules/widget/ui/screens/widget-auth-screen.tsx`)
- Admin dashboard → Convex API: queries and mutates
- Knowledge files → File processing: uploads documents
- File processing → RAG retrieval: indexes content
- Customer widget → Messages: sends questions
- Support agent → Knowledge search: retrieves context
- Knowledge search → RAG retrieval: searches vectors
- Support agent → Messages: produces response
- Support agent → Resolve or escalate: classifies outcome
- Conversation management → Application data: tracks state
- Messages → Application data: stores messages
- Voice integration → VAPI voice service: connects voice
- Customer widget → VAPI voice service: supports voice calls
- Plans and billing → Clerk identity and billing: uses billing
