# optculture/service-crm architecture

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

- Interactive diagram: https://gitdiagram.com/optculture/service-crm
- Repository: https://github.com/optculture/service-crm

## Overview

Chatwoot is a self-hosted customer-support platform. The principal workflow is that a customer contacts a business through a supported channel; agents handle the resulting conversation in a shared inbox, with collaboration and routing features, while customers can also find answers in the Help Center. The graph preserves major documented capabilities, including Captain, campaigns, integrations, and reporting. Source excerpts are limited, so most internal service-to-service calls are not asserted; dashed edges mark documented or unverified relationships.

Main entry points: [`app/controllers/api/v1/accounts/conversations_controller.rb`](https://github.com/optculture/service-crm/blob/develop/app/controllers/api/v1/accounts/conversations_controller.rb) (Conversation API), [`app/javascript/dashboard/App.vue`](https://github.com/optculture/service-crm/blob/develop/app/javascript/dashboard/App.vue) (Agent Dashboard), [`app/controllers/api/v1/accounts/base_controller.rb`](https://github.com/optculture/service-crm/blob/develop/app/controllers/api/v1/accounts/base_controller.rb) (Account API), [`app/controllers/api/v1/accounts/integrations/apps_controller.rb`](https://github.com/optculture/service-crm/blob/develop/app/controllers/api/v1/accounts/integrations/apps_controller.rb) (Integrations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desk["Support Desk"]
  node_dashboard["Agent Dashboard<br/>[App.vue]"]
  node_account_api["Account API<br/>[base_controller.rb]"]
  node_conversation_api["Conversation API"]
  node_messages_api["Message API"]
  node_contacts["Contact Management"]
  node_assignment["Assignment Policies"]
  node_channel_webhooks["Channel Webhooks"]
  node_public_inbox["Website Inbox API"]
  node_database[("Application Data")]
end

subgraph group_engagement["Customer Engagement"]
  node_help_center["Help Center"]
  node_campaigns["Campaigns"]
  node_csat["CSAT Surveys"]
end

subgraph group_insights["Insights and Search"]
  node_search["Search<br/>[search_service.rb]"]
  node_reports["Reports"]
  node_live_reports["Live Reports"]
end

subgraph group_platform["AI and Integrations"]
  node_captain["Captain Tasks"]
  node_llm["LLM Requests"]
  node_integrations["Integrations<br/>[apps_controller.rb]"]
  node_webhook_events["Webhook Events"]
end

node_customer(("Customer"))
node_agent(("Support Agent"))

node_customer -.->|"contacts via"| node_channel_webhooks
node_customer -.->|"starts conversations"| node_public_inbox
node_customer -.->|"finds answers"| node_help_center
node_agent -.->|"handles support"| node_dashboard
node_dashboard -.->|"uses API"| node_account_api
node_account_api -->|"routes requests"| node_conversation_api
node_conversation_api -->|"routes messages"| node_messages_api
node_conversation_api -.->|"manages contacts"| node_contacts
node_conversation_api -.->|"supports routing"| node_assignment
node_agent -.->|"manages campaigns"| node_campaigns
node_customer -.->|"provides feedback"| node_csat
node_captain -.->|"uses language models"| node_llm
node_agent -.->|"uses integrations"| node_integrations
node_webhook_events -.->|"dispatches events"| node_integrations
node_agent -.->|"searches records"| node_search
node_agent -.->|"views reports"| node_reports
node_agent -.->|"monitors activity"| node_live_reports
node_conversation_api -.->|"reads and writes"| node_database

click node_dashboard "https://github.com/optculture/service-crm/blob/develop/app/javascript/dashboard/App.vue"
click node_account_api "https://github.com/optculture/service-crm/blob/develop/app/controllers/api/v1/accounts/base_controller.rb"
click node_conversation_api "https://github.com/optculture/service-crm/blob/develop/app/controllers/api/v1/accounts/conversations_controller.rb"
click node_messages_api "https://github.com/optculture/service-crm/blob/develop/app/controllers/api/v1/accounts/conversations/messages_controller.rb"
click node_contacts "https://github.com/optculture/service-crm/blob/develop/app/controllers/api/v1/accounts/contacts_controller.rb"
click node_assignment "https://github.com/optculture/service-crm/blob/develop/app/controllers/api/v1/accounts/assignment_policies_controller.rb"
click node_channel_webhooks "https://github.com/optculture/service-crm/blob/develop/app/controllers/webhooks/whatsapp_controller.rb"
click node_public_inbox "https://github.com/optculture/service-crm/blob/develop/app/controllers/public/api/v1/inboxes/conversations_controller.rb"
click node_help_center "https://github.com/optculture/service-crm/blob/develop/app/controllers/public/api/v1/portals/articles_controller.rb"
click node_campaigns "https://github.com/optculture/service-crm/blob/develop/app/controllers/api/v1/accounts/campaigns_controller.rb"
click node_csat "https://github.com/optculture/service-crm/blob/develop/app/controllers/api/v1/accounts/csat_survey_responses_controller.rb"
click node_captain "https://github.com/optculture/service-crm/blob/develop/lib/captain/base_task_service.rb"
click node_llm "https://github.com/optculture/service-crm/blob/develop/lib/integrations/llm_base_service.rb"
click node_integrations "https://github.com/optculture/service-crm/blob/develop/app/controllers/api/v1/accounts/integrations/apps_controller.rb"
click node_webhook_events "https://github.com/optculture/service-crm/blob/develop/app/listeners/webhook_listener.rb"
click node_search "https://github.com/optculture/service-crm/blob/develop/app/services/search_service.rb"
click node_reports "https://github.com/optculture/service-crm/blob/develop/app/controllers/api/v2/accounts/reports_controller.rb"
click node_live_reports "https://github.com/optculture/service-crm/blob/develop/app/controllers/api/v2/accounts/live_reports_controller.rb"

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_dashboard,node_account_api,node_conversation_api,node_messages_api,node_contacts,node_assignment,node_channel_webhooks,node_public_inbox,node_database toneBlue
class node_help_center,node_campaigns,node_csat toneAmber
class node_search,node_reports,node_live_reports toneMint
class node_captain,node_llm,node_integrations,node_webhook_events toneRose
class node_customer,node_agent toneIndigo
```

## Components

### Support Desk

- [Agent Dashboard](https://github.com/optculture/service-crm/blob/develop/app/javascript/dashboard/App.vue): `app/javascript/dashboard/App.vue`
- [Account API](https://github.com/optculture/service-crm/blob/develop/app/controllers/api/v1/accounts/base_controller.rb): `app/controllers/api/v1/accounts/base_controller.rb`
- [Conversation API](https://github.com/optculture/service-crm/blob/develop/app/controllers/api/v1/accounts/conversations_controller.rb): `app/controllers/api/v1/accounts/conversations_controller.rb`
- [Message API](https://github.com/optculture/service-crm/blob/develop/app/controllers/api/v1/accounts/conversations/messages_controller.rb): `app/controllers/api/v1/accounts/conversations/messages_controller.rb`
- [Contact Management](https://github.com/optculture/service-crm/blob/develop/app/controllers/api/v1/accounts/contacts_controller.rb): `app/controllers/api/v1/accounts/contacts_controller.rb`
- [Assignment Policies](https://github.com/optculture/service-crm/blob/develop/app/controllers/api/v1/accounts/assignment_policies_controller.rb): `app/controllers/api/v1/accounts/assignment_policies_controller.rb`
- [Channel Webhooks](https://github.com/optculture/service-crm/blob/develop/app/controllers/webhooks/whatsapp_controller.rb): `app/controllers/webhooks/whatsapp_controller.rb`
- [Website Inbox API](https://github.com/optculture/service-crm/blob/develop/app/controllers/public/api/v1/inboxes/conversations_controller.rb): `app/controllers/public/api/v1/inboxes/conversations_controller.rb`
- **Application Data**

### Customer Engagement

- [Help Center](https://github.com/optculture/service-crm/blob/develop/app/controllers/public/api/v1/portals/articles_controller.rb): `app/controllers/public/api/v1/portals/articles_controller.rb`
- [Campaigns](https://github.com/optculture/service-crm/blob/develop/app/controllers/api/v1/accounts/campaigns_controller.rb): `app/controllers/api/v1/accounts/campaigns_controller.rb`
- [CSAT Surveys](https://github.com/optculture/service-crm/blob/develop/app/controllers/api/v1/accounts/csat_survey_responses_controller.rb): `app/controllers/api/v1/accounts/csat_survey_responses_controller.rb`

### Insights and Search

- [Search](https://github.com/optculture/service-crm/blob/develop/app/services/search_service.rb): `app/services/search_service.rb`
- [Reports](https://github.com/optculture/service-crm/blob/develop/app/controllers/api/v2/accounts/reports_controller.rb): `app/controllers/api/v2/accounts/reports_controller.rb`
- [Live Reports](https://github.com/optculture/service-crm/blob/develop/app/controllers/api/v2/accounts/live_reports_controller.rb): `app/controllers/api/v2/accounts/live_reports_controller.rb`

### AI and Integrations

- [Captain Tasks](https://github.com/optculture/service-crm/blob/develop/lib/captain/base_task_service.rb): `lib/captain/base_task_service.rb`
- [LLM Requests](https://github.com/optculture/service-crm/blob/develop/lib/integrations/llm_base_service.rb): `lib/integrations/llm_base_service.rb`
- [Integrations](https://github.com/optculture/service-crm/blob/develop/app/controllers/api/v1/accounts/integrations/apps_controller.rb): `app/controllers/api/v1/accounts/integrations/apps_controller.rb`
- [Webhook Events](https://github.com/optculture/service-crm/blob/develop/app/listeners/webhook_listener.rb): `app/listeners/webhook_listener.rb`

### Other components

- **Customer**
- **Support Agent**

## Connections

- Customer → Channel Webhooks: contacts via (evidence: `README.md`)
- Customer → Website Inbox API: starts conversations (evidence: `README.md`)
- Customer → Help Center: finds answers (evidence: `README.md`)
- Support Agent → Agent Dashboard: handles support (evidence: `README.md`)
- Agent Dashboard → Account API: uses API
- Account API → Conversation API: routes requests
- Conversation API → Message API: routes messages
- Conversation API → Contact Management: manages contacts (evidence: `README.md`)
- Conversation API → Assignment Policies: supports routing (evidence: `README.md`)
- Support Agent → Campaigns: manages campaigns (evidence: `README.md`)
- Customer → CSAT Surveys: provides feedback (evidence: `README.md`)
- Captain Tasks → LLM Requests: uses language models
- Support Agent → Integrations: uses integrations (evidence: `README.md`)
- Webhook Events → Integrations: dispatches events
- Support Agent → Search: searches records (evidence: `README.md`)
- Support Agent → Reports: views reports (evidence: `README.md`)
- Support Agent → Live Reports: monitors activity (evidence: `README.md`)
- Conversation API → Application Data: reads and writes
