# arnasdon/wacrm architecture

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

- Interactive diagram: https://gitdiagram.com/arnasdon/wacrm
- Repository: https://github.com/arnasdon/wacrm

## Overview

wacrm is a self-hostable WhatsApp CRM. Agents work from a shared inbox and manage contacts and deals; inbound WhatsApp events also drive automations and optional AI replies, while outbound messaging supports broadcasts. The product additionally provides flows, account/team controls, dashboards, a public REST API, and an MCP server. The graph combines README-documented capabilities with source-index references and excerpts; unsampled feature internals are represented at their existing route or component paths, and unverified links are omitted.

Main entry points: [`src/app/api/whatsapp/webhook/route.ts`](https://github.com/arnasdon/wacrm/blob/main/src/app/api/whatsapp/webhook/route.ts) (WhatsApp events), [`src/lib/automations/engine.ts`](https://github.com/arnasdon/wacrm/blob/main/src/lib/automations/engine.ts) (No-code automations), [`src/lib/supabase/server.ts`](https://github.com/arnasdon/wacrm/blob/main/src/lib/supabase/server.ts) (Supabase data and auth), [`src/lib/whatsapp/meta-api.ts`](https://github.com/arnasdon/wacrm/blob/main/src/lib/whatsapp/meta-api.ts) (Meta WhatsApp API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_engage["Customer engagement"]
  node_dashboard["CRM dashboard<br/>[page.tsx]"]
  node_inbox["Shared inbox<br/>[page.tsx]"]
  node_inbox_ui["Conversation tools<br/>[message-thread.tsx]"]
  node_wa_webhook["WhatsApp events<br/>[route.ts]"]
  node_wa_send["WhatsApp sending<br/>[route.ts]"]
  node_meta["Meta WhatsApp API<br/>[meta-api.ts]"]
  node_broadcasts["Broadcast campaigns<br/>[page.tsx]"]
  node_broadcast_api["Broadcast dispatch<br/>[route.ts]"]
end

subgraph group_operations["CRM operations"]
  node_contacts["Contacts and tags<br/>[page.tsx]"]
  node_contact_import["Contact import<br/>[import-modal.tsx]"]
  node_pipelines["Sales pipelines<br/>[pipeline-board.tsx]"]
end

subgraph group_automation["Automation and AI"]
  node_automations["No-code automations<br/>[engine.ts]"]
  node_automation_ui["Automation builder"]
  node_flows["Flow runner<br/>[engine.ts]"]
  node_flow_ui["Flow builder<br/>[flow-builder.tsx]"]
  node_ai["AI replies and knowledge<br/>[auto-reply.ts]"]
  node_ai_ui["AI configuration<br/>[ai-knowledge.tsx]"]
end

subgraph group_platform["Platform access"]
  node_accounts["Teams and roles<br/>[account.ts]"]
  node_auth_ui["Session and account state<br/>[use-auth.tsx]"]
  node_rest["Public REST API<br/>[route.ts]"]
  node_mcp["MCP server tools<br/>[read.ts]"]
  node_supabase[("Supabase data and auth<br/>[server.ts]")]
end

node_agents(("CRM agents"))
node_external_clients(("API and MCP clients"))
node_whatsapp_users(("WhatsApp users"))

node_agents -->|"work conversations"| node_inbox
node_agents -->|"manage contacts"| node_contacts
node_agents -->|"manage deals"| node_pipelines
node_agents -->|"create campaigns"| node_broadcasts
node_inbox -.->|"renders tools"| node_inbox_ui
node_whatsapp_users -->|"send events"| node_wa_webhook
node_wa_webhook -->|"runs triggers"| node_automations
node_wa_webhook -->|"dispatches inbound"| node_flows
node_wa_webhook -->|"invokes replies"| node_ai
node_wa_webhook -->|"resolves contacts"| node_contacts
node_wa_send -->|"sends messages"| node_meta
node_broadcast_api -->|"dispatches templates"| node_meta
node_broadcasts -.->|"starts sends"| node_broadcast_api
node_automations -.->|"sends replies"| node_meta
node_automations -->|"reads and updates"| node_supabase
node_flows -->|"updates run state"| node_supabase
node_automations -.->|"sends via"| node_wa_send
node_agents -->|"views activity"| node_dashboard
node_agents -->|"builds automations"| node_automation_ui
node_agents -->|"builds flows"| node_flow_ui
node_agents -->|"configures knowledge"| node_ai_ui
node_auth_ui -->|"loads session"| node_supabase
node_accounts -->|"checks account"| node_supabase
node_external_clients -->|"calls endpoints"| node_rest
node_external_clients -->|"uses MCP tools"| node_mcp

click node_dashboard "https://github.com/arnasdon/wacrm/blob/main/src/app/(dashboard)/dashboard/page.tsx"
click node_inbox "https://github.com/arnasdon/wacrm/blob/main/src/app/(dashboard)/inbox/page.tsx"
click node_inbox_ui "https://github.com/arnasdon/wacrm/blob/main/src/components/inbox/message-thread.tsx"
click node_wa_webhook "https://github.com/arnasdon/wacrm/blob/main/src/app/api/whatsapp/webhook/route.ts"
click node_wa_send "https://github.com/arnasdon/wacrm/blob/main/src/app/api/whatsapp/send/route.ts"
click node_meta "https://github.com/arnasdon/wacrm/blob/main/src/lib/whatsapp/meta-api.ts"
click node_contacts "https://github.com/arnasdon/wacrm/blob/main/src/app/(dashboard)/contacts/page.tsx"
click node_contact_import "https://github.com/arnasdon/wacrm/blob/main/src/components/contacts/import-modal.tsx"
click node_pipelines "https://github.com/arnasdon/wacrm/blob/main/src/components/pipelines/pipeline-board.tsx"
click node_broadcasts "https://github.com/arnasdon/wacrm/blob/main/src/app/(dashboard)/broadcasts/page.tsx"
click node_broadcast_api "https://github.com/arnasdon/wacrm/blob/main/src/app/api/whatsapp/broadcast/route.ts"
click node_automations "https://github.com/arnasdon/wacrm/blob/main/src/lib/automations/engine.ts"
click node_automation_ui "https://github.com/arnasdon/wacrm/blob/main/src/components/automations/automation-builder.tsx"
click node_flows "https://github.com/arnasdon/wacrm/blob/main/src/lib/flows/engine.ts"
click node_flow_ui "https://github.com/arnasdon/wacrm/blob/main/src/components/flows/flow-builder.tsx"
click node_ai "https://github.com/arnasdon/wacrm/blob/main/src/lib/ai/auto-reply.ts"
click node_ai_ui "https://github.com/arnasdon/wacrm/blob/main/src/components/settings/ai-knowledge.tsx"
click node_accounts "https://github.com/arnasdon/wacrm/blob/main/src/lib/auth/account.ts"
click node_auth_ui "https://github.com/arnasdon/wacrm/blob/main/src/hooks/use-auth.tsx"
click node_rest "https://github.com/arnasdon/wacrm/blob/main/src/app/api/v1/messages/route.ts"
click node_mcp "https://github.com/arnasdon/wacrm/blob/main/mcp-server/src/tools/read.ts"
click node_supabase "https://github.com/arnasdon/wacrm/blob/main/src/lib/supabase/server.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_dashboard,node_inbox,node_inbox_ui,node_wa_webhook,node_wa_send,node_meta,node_broadcasts,node_broadcast_api,node_external_clients,node_whatsapp_users toneBlue
class node_contacts,node_contact_import,node_pipelines toneAmber
class node_automations,node_automation_ui,node_flows,node_flow_ui,node_ai,node_ai_ui toneMint
class node_accounts,node_auth_ui,node_rest,node_mcp,node_supabase toneRose
class node_agents toneIndigo
```

## Components

### Customer engagement

- [CRM dashboard](https://github.com/arnasdon/wacrm/blob/main/src/app/(dashboard)/dashboard/page.tsx): `src/app/(dashboard)/dashboard/page.tsx`
- [Shared inbox](https://github.com/arnasdon/wacrm/blob/main/src/app/(dashboard)/inbox/page.tsx): `src/app/(dashboard)/inbox/page.tsx`
- [Conversation tools](https://github.com/arnasdon/wacrm/blob/main/src/components/inbox/message-thread.tsx): `src/components/inbox/message-thread.tsx`
- [WhatsApp events](https://github.com/arnasdon/wacrm/blob/main/src/app/api/whatsapp/webhook/route.ts): `src/app/api/whatsapp/webhook/route.ts`
- [WhatsApp sending](https://github.com/arnasdon/wacrm/blob/main/src/app/api/whatsapp/send/route.ts): `src/app/api/whatsapp/send/route.ts`
- [Meta WhatsApp API](https://github.com/arnasdon/wacrm/blob/main/src/lib/whatsapp/meta-api.ts): `src/lib/whatsapp/meta-api.ts`
- [Broadcast campaigns](https://github.com/arnasdon/wacrm/blob/main/src/app/(dashboard)/broadcasts/page.tsx): `src/app/(dashboard)/broadcasts/page.tsx`
- [Broadcast dispatch](https://github.com/arnasdon/wacrm/blob/main/src/app/api/whatsapp/broadcast/route.ts): `src/app/api/whatsapp/broadcast/route.ts`

### CRM operations

- [Contacts and tags](https://github.com/arnasdon/wacrm/blob/main/src/app/(dashboard)/contacts/page.tsx): `src/app/(dashboard)/contacts/page.tsx`
- [Contact import](https://github.com/arnasdon/wacrm/blob/main/src/components/contacts/import-modal.tsx): `src/components/contacts/import-modal.tsx`
- [Sales pipelines](https://github.com/arnasdon/wacrm/blob/main/src/components/pipelines/pipeline-board.tsx): `src/components/pipelines/pipeline-board.tsx`

### Automation and AI

- [No-code automations](https://github.com/arnasdon/wacrm/blob/main/src/lib/automations/engine.ts): `src/lib/automations/engine.ts`
- [Automation builder](https://github.com/arnasdon/wacrm/blob/main/src/components/automations/automation-builder.tsx): `src/components/automations/automation-builder.tsx`
- [Flow runner](https://github.com/arnasdon/wacrm/blob/main/src/lib/flows/engine.ts): `src/lib/flows/engine.ts`
- [Flow builder](https://github.com/arnasdon/wacrm/blob/main/src/components/flows/flow-builder.tsx): `src/components/flows/flow-builder.tsx`
- [AI replies and knowledge](https://github.com/arnasdon/wacrm/blob/main/src/lib/ai/auto-reply.ts): `src/lib/ai/auto-reply.ts`
- [AI configuration](https://github.com/arnasdon/wacrm/blob/main/src/components/settings/ai-knowledge.tsx): `src/components/settings/ai-knowledge.tsx`

### Platform access

- [Teams and roles](https://github.com/arnasdon/wacrm/blob/main/src/lib/auth/account.ts): `src/lib/auth/account.ts`
- [Session and account state](https://github.com/arnasdon/wacrm/blob/main/src/hooks/use-auth.tsx): `src/hooks/use-auth.tsx`
- [Public REST API](https://github.com/arnasdon/wacrm/blob/main/src/app/api/v1/messages/route.ts): `src/app/api/v1/messages/route.ts`
- [MCP server tools](https://github.com/arnasdon/wacrm/blob/main/mcp-server/src/tools/read.ts): `mcp-server/src/tools/read.ts`
- [Supabase data and auth](https://github.com/arnasdon/wacrm/blob/main/src/lib/supabase/server.ts): `src/lib/supabase/server.ts`

### Other components

- **CRM agents**
- **API and MCP clients**
- **WhatsApp users**

## Connections

- CRM agents → Shared inbox: work conversations (evidence: `README.md`)
- CRM agents → Contacts and tags: manage contacts (evidence: `README.md`)
- CRM agents → Sales pipelines: manage deals (evidence: `README.md`)
- CRM agents → Broadcast campaigns: create campaigns (evidence: `README.md`)
- Shared inbox → Conversation tools: renders tools
- WhatsApp users → WhatsApp events: send events (evidence: `README.md`)
- WhatsApp events → No-code automations: runs triggers (evidence: `src/app/api/whatsapp/webhook/route.ts`)
- WhatsApp events → Flow runner: dispatches inbound (evidence: `src/app/api/whatsapp/webhook/route.ts`)
- WhatsApp events → AI replies and knowledge: invokes replies (evidence: `src/app/api/whatsapp/webhook/route.ts`)
- WhatsApp events → Contacts and tags: resolves contacts (evidence: `src/app/api/whatsapp/webhook/route.ts`)
- WhatsApp sending → Meta WhatsApp API: sends messages (evidence: `src/app/api/whatsapp/send/route.ts`)
- Broadcast dispatch → Meta WhatsApp API: dispatches templates (evidence: `src/app/api/whatsapp/broadcast/route.ts`)
- Broadcast campaigns → Broadcast dispatch: starts sends
- No-code automations → Meta WhatsApp API: sends replies
- No-code automations → Supabase data and auth: reads and updates (evidence: `src/lib/automations/engine.ts`)
- Flow runner → Supabase data and auth: updates run state (evidence: `src/lib/flows/engine.ts`)
- No-code automations → WhatsApp sending: sends via
- CRM agents → CRM dashboard: views activity (evidence: `README.md`)
- CRM agents → Automation builder: builds automations (evidence: `README.md`)
- CRM agents → Flow builder: builds flows (evidence: `README.md`)
- CRM agents → AI configuration: configures knowledge (evidence: `README.md`)
- Session and account state → Supabase data and auth: loads session (evidence: `src/hooks/use-auth.tsx`)
- Teams and roles → Supabase data and auth: checks account (evidence: `src/lib/auth/account.ts`)
- API and MCP clients → Public REST API: calls endpoints (evidence: `README.md`)
- API and MCP clients → MCP server tools: uses MCP tools (evidence: `README.md`)
