# rmyndharis/openwa architecture

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

- Interactive diagram: https://gitdiagram.com/rmyndharis/openwa
- Repository: https://github.com/rmyndharis/openwa

## Overview

OpenWA is a self-hosted WhatsApp API gateway with a React operations dashboard, multi-session lifecycle management, pluggable WhatsApp engines, storage, plugins, caching, and SDKs. The principal workflow is: an operator or API consumer uses the dashboard/SDK, the gateway manages a session, the engine boundary translates operations and events, and WhatsApp produces messages or session state. The sampled files strongly support lifecycle, event, storage, plugin, and engine-boundary relationships; several API modules are represented without unsampled internal call arrows.

Main entry points: [`dashboard/src/App.tsx`](https://github.com/rmyndharis/openwa/blob/main/dashboard/src/App.tsx) (Dashboard Shell), [`dashboard/src/services/api.ts`](https://github.com/rmyndharis/openwa/blob/main/dashboard/src/services/api.ts) (Dashboard API Client), [`src/app.module.ts`](https://github.com/rmyndharis/openwa/blob/main/src/app.module.ts) (HTTP API Gateway), [`src/engine/interfaces/whatsapp-engine.interface.ts`](https://github.com/rmyndharis/openwa/blob/main/src/engine/interfaces/whatsapp-engine.interface.ts) (WhatsApp Engine Boundary)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Clients"]
  node_js_sdk["JavaScript SDK<br/>[client.ts]"]
  node_python_sdk["Python SDK<br/>[client.py]"]
  node_go_sdk["Go SDK<br/>[client.go]"]
  node_java_sdk["Java SDK<br/>[OpenWAClient.java]"]
  node_php_sdk["PHP SDK<br/>[Client.php]"]
end

subgraph group_dashboard["Dashboard"]
  node_dashboard_shell["Dashboard Shell<br/>[App.tsx]"]
  node_sessions_ui["Session Operations<br/>[Sessions.tsx]"]
  node_chats_ui["Chat Operations<br/>[Chats.tsx]"]
  node_infra_ui["Infrastructure UI<br/>[Infrastructure.tsx]"]
  node_plugins_ui["Plugin Management<br/>[Plugins.tsx]"]
  node_webhooks_ui["Webhook Management<br/>[Webhooks.tsx]"]
  node_api_keys_ui["API Key Management<br/>[ApiKeys.tsx]"]
  node_dashboard_api["Dashboard API Client<br/>[api.ts]"]
end

subgraph group_gateway["Gateway Runtime"]
  node_api_gateway["HTTP API Gateway<br/>[app.module.ts]"]
  node_session_lifecycle["Session Lifecycle"]
  node_session_controls["Session Controls"]
  node_event_wiring["Engine Event Wiring"]
end

subgraph group_engines["Engine Layer"]
  node_engine_boundary["WhatsApp Engine Boundary"]
  node_capability_matrix["Capability Matrix"]
  node_engine_patches["Engine Patch Guard"]
end

subgraph group_persistence["Persistence Integrations"]
  node_media_storage[("Media Storage<br/>[storage.service.ts]")]
  node_storage_controller["Storage Operations"]
  node_storage_root[("Storage Root<br/>[storage-root.ts]")]
  node_plugin_storage[("Plugin Storage")]
  node_cache_layer["Cache Layer<br/>[cache.service.ts]"]
end

node_operator(("Operator"))
node_api_consumer(("API Consumer"))
node_whatsapp(("WhatsApp"))
node_s3[("S3 Storage")]
node_redis[("Redis Cache")]

node_operator -->|"uses"| node_dashboard_shell
node_api_consumer -->|"calls"| node_js_sdk
node_api_consumer -->|"calls"| node_python_sdk
node_api_consumer -->|"calls"| node_go_sdk
node_api_consumer -->|"calls"| node_java_sdk
node_api_consumer -->|"calls"| node_php_sdk
node_dashboard_shell -->|"routes"| node_sessions_ui
node_dashboard_shell -->|"routes"| node_chats_ui
node_dashboard_shell -->|"routes"| node_infra_ui
node_dashboard_shell -->|"routes"| node_plugins_ui
node_dashboard_shell -->|"routes"| node_webhooks_ui
node_dashboard_shell -->|"routes"| node_api_keys_ui
node_sessions_ui -->|"requests"| node_dashboard_api
node_chats_ui -->|"requests"| node_dashboard_api
node_infra_ui -->|"requests"| node_dashboard_api
node_plugins_ui -->|"requests"| node_dashboard_api
node_webhooks_ui -->|"requests"| node_dashboard_api
node_api_keys_ui -->|"requests"| node_dashboard_api
node_dashboard_api -->|"calls"| node_api_gateway
node_js_sdk -->|"HTTP calls"| node_api_gateway
node_python_sdk -->|"HTTP calls"| node_api_gateway
node_go_sdk -->|"HTTP calls"| node_api_gateway
node_java_sdk -->|"HTTP calls"| node_api_gateway
node_php_sdk -->|"HTTP calls"| node_api_gateway
node_api_gateway -->|"dispatches"| node_session_lifecycle
node_session_lifecycle -->|"delegates"| node_session_controls
node_session_lifecycle -->|"builds callbacks"| node_event_wiring
node_session_lifecycle -->|"controls engine"| node_engine_boundary
node_session_controls -->|"starts and stops"| node_engine_boundary
node_engine_boundary -->|"emits events"| node_event_wiring
node_event_wiring -->|"receives events"| node_whatsapp
node_engine_boundary -->|"sends operations"| node_whatsapp
node_capability_matrix -->|"derives capabilities"| node_engine_boundary
node_engine_patches -->|"guards adapters"| node_engine_boundary
node_storage_controller -->|"exports files"| node_media_storage
node_media_storage -->|"reads and writes"| node_storage_root
node_media_storage -.->|"uses backend"| node_s3
node_plugin_storage -->|"persists registry"| node_storage_root
node_cache_layer -.->|"uses backend"| node_redis

click node_dashboard_shell "https://github.com/rmyndharis/openwa/blob/main/dashboard/src/App.tsx"
click node_sessions_ui "https://github.com/rmyndharis/openwa/blob/main/dashboard/src/pages/Sessions.tsx"
click node_chats_ui "https://github.com/rmyndharis/openwa/blob/main/dashboard/src/pages/Chats.tsx"
click node_infra_ui "https://github.com/rmyndharis/openwa/blob/main/dashboard/src/pages/Infrastructure.tsx"
click node_plugins_ui "https://github.com/rmyndharis/openwa/blob/main/dashboard/src/pages/Plugins.tsx"
click node_webhooks_ui "https://github.com/rmyndharis/openwa/blob/main/dashboard/src/pages/Webhooks.tsx"
click node_api_keys_ui "https://github.com/rmyndharis/openwa/blob/main/dashboard/src/pages/ApiKeys.tsx"
click node_dashboard_api "https://github.com/rmyndharis/openwa/blob/main/dashboard/src/services/api.ts"
click node_js_sdk "https://github.com/rmyndharis/openwa/blob/main/sdk/javascript/src/client.ts"
click node_python_sdk "https://github.com/rmyndharis/openwa/blob/main/sdk/python/openwa/client.py"
click node_go_sdk "https://github.com/rmyndharis/openwa/blob/main/sdk/go/client.go"
click node_java_sdk "https://github.com/rmyndharis/openwa/blob/main/sdk/java/src/main/java/com/rmyndharis/openwa/OpenWAClient.java"
click node_php_sdk "https://github.com/rmyndharis/openwa/blob/main/sdk/php/src/Client.php"
click node_api_gateway "https://github.com/rmyndharis/openwa/blob/main/src/app.module.ts"
click node_session_lifecycle "https://github.com/rmyndharis/openwa/blob/main/src/modules/session/session-engine-lifecycle.service.ts"
click node_session_controls "https://github.com/rmyndharis/openwa/blob/main/src/modules/session/session-engine-controls.ts"
click node_event_wiring "https://github.com/rmyndharis/openwa/blob/main/src/modules/session/session-engine-event-wiring.ts"
click node_engine_boundary "https://github.com/rmyndharis/openwa/blob/main/src/engine/interfaces/whatsapp-engine.interface.ts"
click node_capability_matrix "https://github.com/rmyndharis/openwa/blob/main/src/engine/engine-capability-matrix.ts"
click node_engine_patches "https://github.com/rmyndharis/openwa/blob/main/src/engine/adapters/engine-patch-status.ts"
click node_media_storage "https://github.com/rmyndharis/openwa/blob/main/src/common/storage/storage.service.ts"
click node_storage_controller "https://github.com/rmyndharis/openwa/blob/main/src/modules/infra/infra-storage.controller.ts"
click node_storage_root "https://github.com/rmyndharis/openwa/blob/main/src/config/storage-root.ts"
click node_plugin_storage "https://github.com/rmyndharis/openwa/blob/main/src/core/plugins/plugin-storage.service.ts"
click node_cache_layer "https://github.com/rmyndharis/openwa/blob/main/src/common/cache/cache.service.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_js_sdk,node_python_sdk,node_go_sdk,node_java_sdk,node_php_sdk toneBlue
class node_dashboard_shell,node_sessions_ui,node_chats_ui,node_infra_ui,node_plugins_ui,node_webhooks_ui,node_api_keys_ui,node_dashboard_api,node_s3,node_redis toneAmber
class node_api_gateway,node_session_lifecycle,node_session_controls,node_event_wiring,node_api_consumer toneMint
class node_engine_boundary,node_capability_matrix,node_engine_patches toneRose
class node_media_storage,node_storage_controller,node_storage_root,node_plugin_storage,node_cache_layer,node_operator,node_whatsapp toneIndigo
```

## Components

### Clients

- [JavaScript SDK](https://github.com/rmyndharis/openwa/blob/main/sdk/javascript/src/client.ts): `sdk/javascript/src/client.ts`
- [Python SDK](https://github.com/rmyndharis/openwa/blob/main/sdk/python/openwa/client.py): `sdk/python/openwa/client.py`
- [Go SDK](https://github.com/rmyndharis/openwa/blob/main/sdk/go/client.go): `sdk/go/client.go`
- [Java SDK](https://github.com/rmyndharis/openwa/blob/main/sdk/java/src/main/java/com/rmyndharis/openwa/OpenWAClient.java): `sdk/java/src/main/java/com/rmyndharis/openwa/OpenWAClient.java`
- [PHP SDK](https://github.com/rmyndharis/openwa/blob/main/sdk/php/src/Client.php): `sdk/php/src/Client.php`

### Dashboard

- [Dashboard Shell](https://github.com/rmyndharis/openwa/blob/main/dashboard/src/App.tsx): `dashboard/src/App.tsx`
- [Session Operations](https://github.com/rmyndharis/openwa/blob/main/dashboard/src/pages/Sessions.tsx): `dashboard/src/pages/Sessions.tsx`
- [Chat Operations](https://github.com/rmyndharis/openwa/blob/main/dashboard/src/pages/Chats.tsx): `dashboard/src/pages/Chats.tsx`
- [Infrastructure UI](https://github.com/rmyndharis/openwa/blob/main/dashboard/src/pages/Infrastructure.tsx): `dashboard/src/pages/Infrastructure.tsx`
- [Plugin Management](https://github.com/rmyndharis/openwa/blob/main/dashboard/src/pages/Plugins.tsx): `dashboard/src/pages/Plugins.tsx`
- [Webhook Management](https://github.com/rmyndharis/openwa/blob/main/dashboard/src/pages/Webhooks.tsx): `dashboard/src/pages/Webhooks.tsx`
- [API Key Management](https://github.com/rmyndharis/openwa/blob/main/dashboard/src/pages/ApiKeys.tsx): `dashboard/src/pages/ApiKeys.tsx`
- [Dashboard API Client](https://github.com/rmyndharis/openwa/blob/main/dashboard/src/services/api.ts): `dashboard/src/services/api.ts`

### Gateway Runtime

- [HTTP API Gateway](https://github.com/rmyndharis/openwa/blob/main/src/app.module.ts): `src/app.module.ts`
- [Session Lifecycle](https://github.com/rmyndharis/openwa/blob/main/src/modules/session/session-engine-lifecycle.service.ts): `src/modules/session/session-engine-lifecycle.service.ts`
- [Session Controls](https://github.com/rmyndharis/openwa/blob/main/src/modules/session/session-engine-controls.ts): `src/modules/session/session-engine-controls.ts`
- [Engine Event Wiring](https://github.com/rmyndharis/openwa/blob/main/src/modules/session/session-engine-event-wiring.ts): `src/modules/session/session-engine-event-wiring.ts`

### Engine Layer

- [WhatsApp Engine Boundary](https://github.com/rmyndharis/openwa/blob/main/src/engine/interfaces/whatsapp-engine.interface.ts): `src/engine/interfaces/whatsapp-engine.interface.ts`
- [Capability Matrix](https://github.com/rmyndharis/openwa/blob/main/src/engine/engine-capability-matrix.ts): `src/engine/engine-capability-matrix.ts`
- [Engine Patch Guard](https://github.com/rmyndharis/openwa/blob/main/src/engine/adapters/engine-patch-status.ts): `src/engine/adapters/engine-patch-status.ts`

### Persistence Integrations

- [Media Storage](https://github.com/rmyndharis/openwa/blob/main/src/common/storage/storage.service.ts): `src/common/storage/storage.service.ts`
- [Storage Operations](https://github.com/rmyndharis/openwa/blob/main/src/modules/infra/infra-storage.controller.ts): `src/modules/infra/infra-storage.controller.ts`
- [Storage Root](https://github.com/rmyndharis/openwa/blob/main/src/config/storage-root.ts): `src/config/storage-root.ts`
- [Plugin Storage](https://github.com/rmyndharis/openwa/blob/main/src/core/plugins/plugin-storage.service.ts): `src/core/plugins/plugin-storage.service.ts`
- [Cache Layer](https://github.com/rmyndharis/openwa/blob/main/src/common/cache/cache.service.ts): `src/common/cache/cache.service.ts`

### Other components

- **Operator**
- **API Consumer**
- **WhatsApp**
- **S3 Storage**
- **Redis Cache**

## Connections

- Operator → Dashboard Shell: uses
- API Consumer → JavaScript SDK: calls
- API Consumer → Python SDK: calls
- API Consumer → Go SDK: calls
- API Consumer → Java SDK: calls
- API Consumer → PHP SDK: calls
- Dashboard Shell → Session Operations: routes
- Dashboard Shell → Chat Operations: routes
- Dashboard Shell → Infrastructure UI: routes
- Dashboard Shell → Plugin Management: routes
- Dashboard Shell → Webhook Management: routes
- Dashboard Shell → API Key Management: routes
- Session Operations → Dashboard API Client: requests
- Chat Operations → Dashboard API Client: requests
- Infrastructure UI → Dashboard API Client: requests
- Plugin Management → Dashboard API Client: requests
- Webhook Management → Dashboard API Client: requests
- API Key Management → Dashboard API Client: requests
- Dashboard API Client → HTTP API Gateway: calls
- JavaScript SDK → HTTP API Gateway: HTTP calls
- Python SDK → HTTP API Gateway: HTTP calls
- Go SDK → HTTP API Gateway: HTTP calls
- Java SDK → HTTP API Gateway: HTTP calls
- PHP SDK → HTTP API Gateway: HTTP calls
- HTTP API Gateway → Session Lifecycle: dispatches
- Session Lifecycle → Session Controls: delegates
- Session Lifecycle → Engine Event Wiring: builds callbacks
- Session Lifecycle → WhatsApp Engine Boundary: controls engine
- Session Controls → WhatsApp Engine Boundary: starts and stops
- WhatsApp Engine Boundary → Engine Event Wiring: emits events
- Engine Event Wiring → WhatsApp: receives events
- WhatsApp Engine Boundary → WhatsApp: sends operations
- Capability Matrix → WhatsApp Engine Boundary: derives capabilities
- Engine Patch Guard → WhatsApp Engine Boundary: guards adapters
- Storage Operations → Media Storage: exports files
- Media Storage → Storage Root: reads and writes
- Media Storage → S3 Storage: uses backend
- Plugin Storage → Storage Root: persists registry
- Cache Layer → Redis Cache: uses backend
