# baihaqi34/jalurgaib-wa-gateway architecture

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

- Interactive diagram: https://gitdiagram.com/baihaqi34/jalurgaib-wa-gateway
- Repository: https://github.com/baihaqi34/jalurgaib-wa-gateway

## Overview

WA Gateway lets users connect WhatsApp devices and send messages through an API. The principal flow is client request → Laravel authentication and message handling → queued delivery → Go/whatsmeow service → WhatsApp. Laravel also manages devices, message history, API keys, quotas, packages, and admin/user dashboards. The README documents the Go service’s multi-device sessions, reconnect behavior, delays, and SQLite persistence. Some controller and service relationships are supported by the source index rather than full excerpts; unsampled capability links are documented in the README.

Main entry points: [`backend/routes/api.php`](https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/routes/api.php) (API Routes), [`backend/app/Services/WhatsAppService.php`](https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/app/Services/WhatsAppService.php) (WhatsApp Client), [`backend/app/Models`](https://github.com/baihaqi34/jalurgaib-wa-gateway/tree/main/backend/app/Models) (Gateway Data Models), [`backend/routes/web.php`](https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/routes/web.php) (Web Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and Accounts"]
  node_routes_api["API Routes<br/>[api.php]"]
  node_auth["API Authentication<br/>[ApiKeyAuth.php]"]
  node_auth_controller["API Auth"]
  node_api_keys["API Key Management"]
  node_web_routes["Web Routes<br/>[web.php]"]
  node_web_auth["Web Authentication<br/>[AuthController.php]"]
end

subgraph group_gateway["Laravel Gateway"]
  node_device_api["Device API"]
  node_message_api["Message API"]
  node_queue_job["Delivery Job"]
  node_wa_client["WhatsApp Client"]
  node_models["Gateway Data Models"]
  node_database[("Relational Database<br/>[database.php]")]
end

subgraph group_operations["Management and Plans"]
  node_admin["Admin Management"]
  node_admin_dashboard["Admin Dashboard"]
  node_user_dashboard["User Dashboard"]
  node_user_views["User Portal Views"]
  node_welcome["Gateway Landing<br/>[welcome.blade.php]"]
end

subgraph group_delivery["WhatsApp Delivery"]
  node_go_service["Go WhatsApp Service<br/>[main.go]"]
  node_sqlite_sessions[("SQLite Sessions")]
end

node_client(("Client App"))
node_whatsapp(("WhatsApp Network"))

node_client -->|"calls API"| node_routes_api
node_routes_api -->|"routes auth"| node_auth_controller
node_routes_api -->|"routes devices"| node_device_api
node_routes_api -->|"routes messages"| node_message_api
node_routes_api -->|"routes keys"| node_api_keys
node_routes_api -.->|"applies key auth"| node_auth
node_web_routes -->|"routes login"| node_web_auth
node_web_routes -->|"routes admin"| node_admin
node_web_routes -->|"routes dashboard"| node_admin_dashboard
node_web_routes -->|"routes user area"| node_user_dashboard
node_device_api -->|"reads and updates"| node_models
node_device_api -->|"requests device actions"| node_wa_client
node_message_api -->|"creates and queries"| node_models
node_message_api -->|"dispatches delivery"| node_queue_job
node_message_api -->|"checks device status"| node_wa_client
node_queue_job -->|"sends message"| node_wa_client
node_wa_client -->|"HTTP requests"| node_go_service
node_go_service -->|"uses protocol"| node_whatsapp
node_go_service -->|"persists sessions"| node_sqlite_sessions
node_admin -->|"manages accounts"| node_models
node_admin_dashboard -->|"reads metrics"| node_models
node_admin_dashboard -->|"checks service"| node_wa_client
node_user_dashboard -->|"reads account stats"| node_models
node_user_dashboard -->|"refreshes device status"| node_wa_client
node_user_dashboard -->|"renders"| node_user_views
node_models -.->|"stores records"| node_database
node_web_auth -.->|"serves portal"| node_welcome

click node_routes_api "https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/routes/api.php"
click node_auth "https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/app/Http/Middleware/ApiKeyAuth.php"
click node_auth_controller "https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/app/Http/Controllers/Auth/LoginController.php"
click node_api_keys "https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/app/Http/Controllers/Api/ApiKeyController.php"
click node_web_routes "https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/routes/web.php"
click node_web_auth "https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/app/Http/Controllers/Web/AuthController.php"
click node_device_api "https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/app/Http/Controllers/Api/DeviceController.php"
click node_message_api "https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/app/Http/Controllers/Api/MessageController.php"
click node_queue_job "https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/app/Jobs/SendWhatsAppMessage.php"
click node_wa_client "https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/app/Services/WhatsAppService.php"
click node_models "https://github.com/baihaqi34/jalurgaib-wa-gateway/tree/main/backend/app/Models"
click node_database "https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/config/database.php"
click node_admin "https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/app/Http/Controllers/Admin/AdminUserController.php"
click node_admin_dashboard "https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/app/Http/Controllers/Admin/AdminDashboardController.php"
click node_user_dashboard "https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/app/Http/Controllers/User/UserDashboardController.php"
click node_user_views "https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/resources/views/user/dashboard.blade.php"
click node_welcome "https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/resources/views/welcome.blade.php"
click node_go_service "https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/wa-service/main.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_routes_api,node_auth,node_auth_controller,node_api_keys,node_web_routes,node_web_auth,node_client toneBlue
class node_device_api,node_message_api,node_queue_job,node_wa_client,node_models,node_database toneAmber
class node_admin,node_admin_dashboard,node_user_dashboard,node_user_views,node_welcome toneMint
class node_go_service,node_sqlite_sessions toneRose
class node_whatsapp toneIndigo
```

## Components

### Access and Accounts

- [API Routes](https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/routes/api.php): `backend/routes/api.php`
- [API Authentication](https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/app/Http/Middleware/ApiKeyAuth.php): `backend/app/Http/Middleware/ApiKeyAuth.php`
- [API Auth](https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/app/Http/Controllers/Auth/LoginController.php): `backend/app/Http/Controllers/Auth/LoginController.php`
- [API Key Management](https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/app/Http/Controllers/Api/ApiKeyController.php): `backend/app/Http/Controllers/Api/ApiKeyController.php`
- [Web Routes](https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/routes/web.php): `backend/routes/web.php`
- [Web Authentication](https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/app/Http/Controllers/Web/AuthController.php): `backend/app/Http/Controllers/Web/AuthController.php`

### Laravel Gateway

- [Device API](https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/app/Http/Controllers/Api/DeviceController.php): `backend/app/Http/Controllers/Api/DeviceController.php`
- [Message API](https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/app/Http/Controllers/Api/MessageController.php): `backend/app/Http/Controllers/Api/MessageController.php`
- [Delivery Job](https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/app/Jobs/SendWhatsAppMessage.php): `backend/app/Jobs/SendWhatsAppMessage.php`
- [WhatsApp Client](https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/app/Services/WhatsAppService.php): `backend/app/Services/WhatsAppService.php`
- [Gateway Data Models](https://github.com/baihaqi34/jalurgaib-wa-gateway/tree/main/backend/app/Models): `backend/app/Models`
- [Relational Database](https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/config/database.php): `backend/config/database.php`

### Management and Plans

- [Admin Management](https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/app/Http/Controllers/Admin/AdminUserController.php): `backend/app/Http/Controllers/Admin/AdminUserController.php`
- [Admin Dashboard](https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/app/Http/Controllers/Admin/AdminDashboardController.php): `backend/app/Http/Controllers/Admin/AdminDashboardController.php`
- [User Dashboard](https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/app/Http/Controllers/User/UserDashboardController.php): `backend/app/Http/Controllers/User/UserDashboardController.php`
- [User Portal Views](https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/resources/views/user/dashboard.blade.php): `backend/resources/views/user/dashboard.blade.php`
- [Gateway Landing](https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/backend/resources/views/welcome.blade.php): `backend/resources/views/welcome.blade.php`

### WhatsApp Delivery

- [Go WhatsApp Service](https://github.com/baihaqi34/jalurgaib-wa-gateway/blob/main/wa-service/main.go): `wa-service/main.go`
- **SQLite Sessions**

### Other components

- **Client App**
- **WhatsApp Network**

## Connections

- Client App → API Routes: calls API (evidence: `README.md`)
- API Routes → API Auth: routes auth (evidence: `backend/routes/api.php`)
- API Routes → Device API: routes devices (evidence: `backend/routes/api.php`)
- API Routes → Message API: routes messages (evidence: `backend/routes/api.php`)
- API Routes → API Key Management: routes keys (evidence: `backend/routes/api.php`)
- API Routes → API Authentication: applies key auth
- Web Routes → Web Authentication: routes login (evidence: `backend/routes/web.php`)
- Web Routes → Admin Management: routes admin (evidence: `backend/routes/web.php`)
- Web Routes → Admin Dashboard: routes dashboard (evidence: `backend/routes/web.php`)
- Web Routes → User Dashboard: routes user area (evidence: `backend/routes/web.php`)
- Device API → Gateway Data Models: reads and updates (evidence: `backend/app/Http/Controllers/Api/DeviceController.php`)
- Device API → WhatsApp Client: requests device actions (evidence: `backend/app/Http/Controllers/Api/DeviceController.php`)
- Message API → Gateway Data Models: creates and queries (evidence: `backend/app/Http/Controllers/Api/MessageController.php`)
- Message API → Delivery Job: dispatches delivery (evidence: `backend/app/Http/Controllers/Api/MessageController.php`)
- Message API → WhatsApp Client: checks device status (evidence: `backend/app/Http/Controllers/Api/MessageController.php`)
- Delivery Job → WhatsApp Client: sends message (evidence: `backend/app/Jobs/SendWhatsAppMessage.php`)
- WhatsApp Client → Go WhatsApp Service: HTTP requests (evidence: `backend/app/Services/WhatsAppService.php`)
- Go WhatsApp Service → WhatsApp Network: uses protocol (evidence: `README.md`)
- Go WhatsApp Service → SQLite Sessions: persists sessions (evidence: `README.md`)
- Admin Management → Gateway Data Models: manages accounts (evidence: `backend/app/Http/Controllers/Admin/AdminUserController.php`)
- Admin Dashboard → Gateway Data Models: reads metrics (evidence: `backend/app/Http/Controllers/Admin/AdminDashboardController.php`)
- Admin Dashboard → WhatsApp Client: checks service (evidence: `backend/app/Http/Controllers/Admin/AdminDashboardController.php`)
- User Dashboard → Gateway Data Models: reads account stats (evidence: `backend/app/Http/Controllers/User/UserDashboardController.php`)
- User Dashboard → WhatsApp Client: refreshes device status (evidence: `backend/app/Http/Controllers/User/UserDashboardController.php`)
- User Dashboard → User Portal Views: renders (evidence: `backend/app/Http/Controllers/User/UserDashboardController.php`)
- Gateway Data Models → Relational Database: stores records
- Web Authentication → Gateway Landing: serves portal
