# xnetinho/watink architecture

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

- Interactive diagram: https://gitdiagram.com/xnetinho/watink
- Repository: https://github.com/xnetinho/watink

## Overview

Watink is an open-source, multi-agent WhatsApp customer-service and automation platform. The main workflow is a team member using the web app to manage conversations and queues; the Business API handles requests and coordinates channel connections, ticketing, and automation. Separate branches cover CRM pipelines, knowledge ingestion and retrieval, optional plugins, and calls/media. The README documents product capabilities; sampled startup, route, controller, and worker sources support only some implementation links, so unsampled subsystem wiring is intentionally not inferred.

Main entry points: [`business/internal/routes/routes.go`](https://github.com/xnetinho/watink/blob/main/business/internal/routes/routes.go) (API routes), [`business/internal/controllers`](https://github.com/xnetinho/watink/tree/main/business/internal/controllers) (Feature controllers), [`business/cmd/server/main.go`](https://github.com/xnetinho/watink/blob/main/business/cmd/server/main.go) (Business API), [`business/internal/flow/interpreter.go`](https://github.com/xnetinho/watink/blob/main/business/internal/flow/interpreter.go) (Flow runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web workspace"]
  node_webapp["Web workspace<br/>[useClientModal.ts]"]
end

subgraph group_business["Business API"]
  node_api["Business API<br/>[main.go]"]
  node_routes["API routes<br/>[routes.go]"]
  node_controllers["Feature controllers"]
  node_conversations["Inbox and queues<br/>[ticket.go]"]
  node_crm["CRM pipelines<br/>[pipeline.go]"]
  node_store[("Application database<br/>[database.go]")]
end

subgraph group_automation["Automation and knowledge"]
  node_flows["Flow runtime<br/>[interpreter.go]"]
  node_knowledge["Knowledge ingestion<br/>[ingest_worker.go]"]
end

subgraph group_integrations["Channels and extensions"]
  node_plugins["Optional plugins<br/>[manager.go]"]
  node_channel["WhatsApp channel<br/>[adapter.go]"]
  node_telegram["Telegram channel<br/>[adapter.go]"]
end

subgraph group_engine["WhatsApp engine"]
  node_engine["Messaging engine<br/>[main.go]"]
  node_calls["Call media runtime<br/>[callmanager.go]"]
end

node_agent(("Support team"))
node_rabbit["RabbitMQ"]
node_whatsapp(("WhatsApp users"))

node_agent -->|"uses"| node_webapp
node_webapp -.->|"requests"| node_api
node_api -->|"registers"| node_routes
node_routes -->|"registers"| node_controllers
node_controllers -->|"serves"| node_conversations
node_controllers -->|"serves"| node_crm
node_agent -->|"handles chats"| node_conversations
node_agent -->|"manages deals"| node_crm
node_agent -->|"configures automations"| node_flows
node_routes -->|"registers"| node_flows
node_controllers -.->|"reads and writes"| node_store
node_flows -->|"automates replies"| node_whatsapp
node_knowledge -->|"consumes jobs"| node_rabbit
node_routes -->|"wires retrieval"| node_knowledge
node_routes -->|"registers"| node_plugins
node_routes -->|"registers"| node_channel
node_routes -->|"registers"| node_telegram
node_whatsapp -.->|"sends messages"| node_channel
node_engine -->|"consumes commands"| node_rabbit
node_engine -.->|"connects"| node_whatsapp
node_api -.->|"coordinates calls"| node_calls

click node_webapp "https://github.com/xnetinho/watink/blob/main/frontend/src/pages/Clients/hooks/useClientModal.ts"
click node_api "https://github.com/xnetinho/watink/blob/main/business/cmd/server/main.go"
click node_routes "https://github.com/xnetinho/watink/blob/main/business/internal/routes/routes.go"
click node_controllers "https://github.com/xnetinho/watink/tree/main/business/internal/controllers"
click node_conversations "https://github.com/xnetinho/watink/blob/main/business/internal/controllers/ticket.go"
click node_crm "https://github.com/xnetinho/watink/blob/main/business/internal/controllers/pipeline.go"
click node_store "https://github.com/xnetinho/watink/blob/main/business/internal/database/database.go"
click node_flows "https://github.com/xnetinho/watink/blob/main/business/internal/flow/interpreter.go"
click node_knowledge "https://github.com/xnetinho/watink/blob/main/business/internal/knowledge/ingest_worker.go"
click node_plugins "https://github.com/xnetinho/watink/blob/main/business/internal/plugins/manager.go"
click node_channel "https://github.com/xnetinho/watink/blob/main/business/internal/channels/whatsapp/adapter.go"
click node_telegram "https://github.com/xnetinho/watink/blob/main/business/internal/channels/telegram/adapter.go"
click node_engine "https://github.com/xnetinho/watink/blob/main/engine-go/cmd/engine/main.go"
click node_calls "https://github.com/xnetinho/watink/blob/main/engine-go/internal/voip/call/callmanager.go"

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_webapp,node_whatsapp toneBlue
class node_api,node_routes,node_controllers,node_conversations,node_crm,node_store toneAmber
class node_flows,node_knowledge toneMint
class node_plugins,node_channel,node_telegram toneRose
class node_engine,node_calls,node_agent,node_rabbit toneIndigo
```

## Components

### Web workspace

- [Web workspace](https://github.com/xnetinho/watink/blob/main/frontend/src/pages/Clients/hooks/useClientModal.ts): `frontend/src/pages/Clients/hooks/useClientModal.ts`

### Business API

- [Business API](https://github.com/xnetinho/watink/blob/main/business/cmd/server/main.go): `business/cmd/server/main.go`
- [API routes](https://github.com/xnetinho/watink/blob/main/business/internal/routes/routes.go): `business/internal/routes/routes.go`
- [Feature controllers](https://github.com/xnetinho/watink/tree/main/business/internal/controllers): `business/internal/controllers`
- [Inbox and queues](https://github.com/xnetinho/watink/blob/main/business/internal/controllers/ticket.go): `business/internal/controllers/ticket.go`
- [CRM pipelines](https://github.com/xnetinho/watink/blob/main/business/internal/controllers/pipeline.go): `business/internal/controllers/pipeline.go`
- [Application database](https://github.com/xnetinho/watink/blob/main/business/internal/database/database.go): `business/internal/database/database.go`

### Automation and knowledge

- [Flow runtime](https://github.com/xnetinho/watink/blob/main/business/internal/flow/interpreter.go): `business/internal/flow/interpreter.go`
- [Knowledge ingestion](https://github.com/xnetinho/watink/blob/main/business/internal/knowledge/ingest_worker.go): `business/internal/knowledge/ingest_worker.go`

### Channels and extensions

- [Optional plugins](https://github.com/xnetinho/watink/blob/main/business/internal/plugins/manager.go): `business/internal/plugins/manager.go`
- [WhatsApp channel](https://github.com/xnetinho/watink/blob/main/business/internal/channels/whatsapp/adapter.go): `business/internal/channels/whatsapp/adapter.go`
- [Telegram channel](https://github.com/xnetinho/watink/blob/main/business/internal/channels/telegram/adapter.go): `business/internal/channels/telegram/adapter.go`

### WhatsApp engine

- [Messaging engine](https://github.com/xnetinho/watink/blob/main/engine-go/cmd/engine/main.go): `engine-go/cmd/engine/main.go`
- [Call media runtime](https://github.com/xnetinho/watink/blob/main/engine-go/internal/voip/call/callmanager.go): `engine-go/internal/voip/call/callmanager.go`

### Other components

- **Support team**
- **RabbitMQ**
- **WhatsApp users**

## Connections

- Support team → Web workspace: uses (evidence: `README.md`)
- Web workspace → Business API: requests
- Business API → API routes: registers (evidence: `business/cmd/server/main.go`)
- API routes → Feature controllers: registers (evidence: `business/internal/routes/routes.go`)
- Feature controllers → Inbox and queues: serves
- Feature controllers → CRM pipelines: serves
- Support team → Inbox and queues: handles chats (evidence: `README.md`)
- Support team → CRM pipelines: manages deals (evidence: `README.md`)
- Support team → Flow runtime: configures automations (evidence: `README.md`)
- API routes → Flow runtime: registers (evidence: `business/internal/routes/routes.go`)
- Feature controllers → Application database: reads and writes
- Flow runtime → WhatsApp users: automates replies (evidence: `README.md`)
- Knowledge ingestion → RabbitMQ: consumes jobs (evidence: `business/internal/knowledge/ingest_worker.go`)
- API routes → Knowledge ingestion: wires retrieval (evidence: `business/internal/routes/routes.go`)
- API routes → Optional plugins: registers (evidence: `business/internal/routes/routes.go`)
- API routes → WhatsApp channel: registers (evidence: `business/internal/routes/routes.go`)
- API routes → Telegram channel: registers (evidence: `business/internal/routes/routes.go`)
- WhatsApp users → WhatsApp channel: sends messages
- Messaging engine → RabbitMQ: consumes commands (evidence: `engine-go/cmd/engine/main.go`)
- Messaging engine → WhatsApp users: connects
- Business API → Call media runtime: coordinates calls
