# abhishekahirwar123/whatsapp-business-app architecture

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

- Interactive diagram: https://gitdiagram.com/abhishekahirwar123/whatsapp-business-app
- Repository: https://github.com/abhishekahirwar123/whatsapp-business-app

## Overview

wacrm is a self-hostable WhatsApp CRM. Its main operational loop is receiving WhatsApp webhooks, resolving customer identity and conversation state, then triggering automations and integrations; agents work conversations in a shared inbox. The README also documents contacts, pipelines, broadcasts, AI assistance, team access, a public API, and an MCP server. Several UI-to-route and storage connections are not evidenced by the excerpts, so the graph focuses on documented capabilities and visible dispatches rather than assuming those links.

Main entry points: [`src/app/api/whatsapp/webhook/route.ts`](https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/app/api/whatsapp/webhook/route.ts) (Inbound webhook), [`src/app/(dashboard)/inbox/page.tsx`](https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/app/(dashboard)/inbox/page.tsx) (Shared inbox), [`src/app/(dashboard)/broadcasts/page.tsx`](https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/app/(dashboard)/broadcasts/page.tsx) (Broadcasts), [`src/app/api/whatsapp/send/route.ts`](https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/app/api/whatsapp/send/route.ts) (WhatsApp sending)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_engagement["Customer engagement"]
  node_inbox["Shared inbox<br/>[page.tsx]"]
  node_webhook["Inbound webhook<br/>[route.ts]"]
  node_broadcasts["Broadcasts<br/>[page.tsx]"]
  node_send["WhatsApp sending<br/>[route.ts]"]
  node_meta["Meta API client<br/>[meta-api.ts]"]
end

subgraph group_operations["CRM operations"]
  node_identity["Contact identity<br/>[wa-identity.ts]"]
  node_contacts["Contacts and tags<br/>[page.tsx]"]
  node_pipelines["Sales pipelines<br/>[pipeline-board.tsx]"]
  node_dashboard["Activity dashboard<br/>[page.tsx]"]
end

subgraph group_intelligence["Automation and AI"]
  node_automations["Automation runner<br/>[engine.ts]"]
  node_flows["Flow runner<br/>[engine.ts]"]
  node_ai["AI assistance<br/>[auto-reply.ts]"]
end

subgraph group_platform["Access and integrations"]
  node_account["Team and roles<br/>[account.ts]"]
  node_publicapi["Public REST API<br/>[route.ts]"]
  node_mcp["MCP server<br/>[index.ts]"]
  node_supabase[("Supabase")]
  node_webhooks["Outbound webhooks<br/>[deliver.ts]"]
end

node_agent(("CRM agent"))
node_whatsapp{{"WhatsApp Business"}}

node_whatsapp -->|"delivers events"| node_webhook
node_webhook -->|"resolves identity"| node_identity
node_agent -->|"handles conversations"| node_inbox
node_agent -->|"manages contacts"| node_contacts
node_agent -->|"manages deals"| node_pipelines
node_agent -->|"creates broadcasts"| node_broadcasts
node_broadcasts -->|"sends templates"| node_whatsapp
node_inbox -.->|"sends replies"| node_send
node_send -->|"calls client"| node_meta
node_meta -->|"sends messages"| node_whatsapp
node_webhook -->|"dispatches triggers"| node_automations
node_webhook -->|"dispatches flows"| node_flows
node_webhook -.->|"may trigger replies"| node_ai
node_webhook -->|"dispatches events"| node_webhooks
node_agent -->|"reviews activity"| node_dashboard
node_agent -->|"uses API"| node_publicapi
node_agent -->|"uses assistant tools"| node_mcp
node_agent -->|"manages team"| node_account
node_account -->|"reads account"| node_supabase

click node_inbox "https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/app/(dashboard)/inbox/page.tsx"
click node_webhook "https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/app/api/whatsapp/webhook/route.ts"
click node_identity "https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/lib/whatsapp/wa-identity.ts"
click node_contacts "https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/app/(dashboard)/contacts/page.tsx"
click node_pipelines "https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/components/pipelines/pipeline-board.tsx"
click node_broadcasts "https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/app/(dashboard)/broadcasts/page.tsx"
click node_send "https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/app/api/whatsapp/send/route.ts"
click node_meta "https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/lib/whatsapp/meta-api.ts"
click node_automations "https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/lib/automations/engine.ts"
click node_flows "https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/lib/flows/engine.ts"
click node_ai "https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/lib/ai/auto-reply.ts"
click node_dashboard "https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/app/(dashboard)/dashboard/page.tsx"
click node_account "https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/lib/auth/account.ts"
click node_publicapi "https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/app/api/v1/messages/route.ts"
click node_mcp "https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/mcp-server/src/index.ts"
click node_webhooks "https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/lib/webhooks/deliver.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_inbox,node_webhook,node_broadcasts,node_send,node_meta toneBlue
class node_identity,node_contacts,node_pipelines,node_dashboard toneAmber
class node_automations,node_flows,node_ai toneMint
class node_account,node_publicapi,node_mcp,node_supabase,node_webhooks toneRose
class node_agent,node_whatsapp toneIndigo
```

## Components

### Customer engagement

- [Shared inbox](https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/app/(dashboard)/inbox/page.tsx): `src/app/(dashboard)/inbox/page.tsx`
- [Inbound webhook](https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/app/api/whatsapp/webhook/route.ts): `src/app/api/whatsapp/webhook/route.ts`
- [Broadcasts](https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/app/(dashboard)/broadcasts/page.tsx): `src/app/(dashboard)/broadcasts/page.tsx`
- [WhatsApp sending](https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/app/api/whatsapp/send/route.ts): `src/app/api/whatsapp/send/route.ts`
- [Meta API client](https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/lib/whatsapp/meta-api.ts): `src/lib/whatsapp/meta-api.ts`

### CRM operations

- [Contact identity](https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/lib/whatsapp/wa-identity.ts): `src/lib/whatsapp/wa-identity.ts`
- [Contacts and tags](https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/app/(dashboard)/contacts/page.tsx): `src/app/(dashboard)/contacts/page.tsx`
- [Sales pipelines](https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/components/pipelines/pipeline-board.tsx): `src/components/pipelines/pipeline-board.tsx`
- [Activity dashboard](https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/app/(dashboard)/dashboard/page.tsx): `src/app/(dashboard)/dashboard/page.tsx`

### Automation and AI

- [Automation runner](https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/lib/automations/engine.ts): `src/lib/automations/engine.ts`
- [Flow runner](https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/lib/flows/engine.ts): `src/lib/flows/engine.ts`
- [AI assistance](https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/lib/ai/auto-reply.ts): `src/lib/ai/auto-reply.ts`

### Access and integrations

- [Team and roles](https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/lib/auth/account.ts): `src/lib/auth/account.ts`
- [Public REST API](https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/app/api/v1/messages/route.ts): `src/app/api/v1/messages/route.ts`
- [MCP server](https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/mcp-server/src/index.ts): `mcp-server/src/index.ts`
- **Supabase**
- [Outbound webhooks](https://github.com/abhishekahirwar123/whatsapp-business-app/blob/main/src/lib/webhooks/deliver.ts): `src/lib/webhooks/deliver.ts`

### Other components

- **CRM agent**
- **WhatsApp Business**

## Connections

- WhatsApp Business → Inbound webhook: delivers events (evidence: `README.md`)
- Inbound webhook → Contact identity: resolves identity (evidence: `src/app/api/whatsapp/webhook/route.ts`)
- CRM agent → Shared inbox: handles conversations (evidence: `README.md`)
- CRM agent → Contacts and tags: manages contacts (evidence: `README.md`)
- CRM agent → Sales pipelines: manages deals (evidence: `README.md`)
- CRM agent → Broadcasts: creates broadcasts (evidence: `README.md`)
- Broadcasts → WhatsApp Business: sends templates (evidence: `README.md`)
- Shared inbox → WhatsApp sending: sends replies
- WhatsApp sending → Meta API client: calls client (evidence: `src/app/api/whatsapp/send/route.ts`)
- Meta API client → WhatsApp Business: sends messages (evidence: `README.md`)
- Inbound webhook → Automation runner: dispatches triggers (evidence: `src/app/api/whatsapp/webhook/route.ts`)
- Inbound webhook → Flow runner: dispatches flows (evidence: `src/lib/flows/engine.ts`)
- Inbound webhook → AI assistance: may trigger replies (evidence: `src/app/api/whatsapp/webhook/route.ts`)
- Inbound webhook → Outbound webhooks: dispatches events (evidence: `src/app/api/whatsapp/webhook/route.ts`)
- CRM agent → Activity dashboard: reviews activity (evidence: `README.md`)
- CRM agent → Public REST API: uses API (evidence: `README.md`)
- CRM agent → MCP server: uses assistant tools (evidence: `README.md`)
- CRM agent → Team and roles: manages team (evidence: `README.md`)
- Team and roles → Supabase: reads account (evidence: `src/lib/auth/account.ts`)
