Skip to main content

04 - System Architecture

Overview

MultiWA follows a modular, layered architecture designed for scalability and maintainability.

┌─────────────────────────────────────────────────────────────┐
│ Admin Dashboard │
│ (Next.js + Shadcn UI) │
└─────────────────────┬───────────────────────┬───────────────┘
│ REST API │ WebSocket
┌─────────────────────▼───────────────────────▼───────────────┐
│ API Gateway │
│ (NestJS + Fastify) │
├─────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Auth │ │ Messaging │ │ Groups │ │
│ │ Module │ │ Module │ │ Module │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Contacts │ │ Broadcast │ │ Webhooks │ │
│ │ Module │ │ Module │ │ Module │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
├─────────────────────────────────────────────────────────────┤
│ Engine Manager │
│ (Baileys / WhatsApp-Web.js) │
├─────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ PostgreSQL │ │ Redis │ │ MinIO/S3 │ │
│ │ (Prisma) │ │ (BullMQ) │ │ (Storage) │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
└─────────────────────────────────────────────────────────────┘

Core Modules

ModuleResponsibility
AuthModuleJWT authentication, API keys
ProfilesModuleWhatsApp sessions management
MessagesModuleSend/receive messages
GroupsModuleGroup CRUD, participants
BulkModuleBulk messaging with variables
ContactsModuleContact management, tags
BroadcastModuleCampaign management
WebhooksModuleEvent delivery
AutomationModuleVisual flow builder
AutoreplyModuleAI-powered auto-replies

Data Flow

1. User Request → API Gateway
2. Authentication → JWT/API Key validation
3. Business Logic → Module service
4. Engine Manager → WhatsApp operation
5. WhatsApp Response → Transform
6. Database → Persist
7. Webhook/WebSocket → Notify subscribers
8. Response → User

Multi-Tenant Architecture

Organization (Tenant)
├── Workspaces
│ ├── Profiles (WhatsApp sessions)
│ │ ├── Contacts
│ │ ├── Conversations
│ │ └── Messages
│ └── Settings
└── Users (RBAC)

← Quick Start · Documentation Index · Database Design →