# nxt-website/nxt-cloud-chat architecture

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

- Interactive diagram: https://gitdiagram.com/nxt-website/nxt-cloud-chat
- Repository: https://github.com/nxt-website/nxt-cloud-chat

## Overview

NXT Cloud Chat is a WordPress plugin that connects a shared WhatsApp inbox, CRM, and OTP login to Meta’s Cloud API while storing CRM data in WordPress. Its principal workflow is managing conversations and contacts, sending or receiving WhatsApp messages, and retaining message and delivery history. Other major branches include sales pipelines, team-scoped access, dashboard reporting, and login verification. The graph combines documented capabilities with sampled source; unsampled feature wiring is represented only where the README documents it.

Main entry points: [`admin/pages`](https://github.com/nxt-website/nxt-cloud-chat/tree/main/admin/pages) (Admin workspace), [`admin/model/nxtcc-auth-handler.php`](https://github.com/nxt-website/nxt-cloud-chat/blob/main/admin/model/nxtcc-auth-handler.php) (OTP workflow), [`includes/routes.php`](https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/routes.php) (Route bootstrap), [`admin/model/nxtcc-history-handler.php`](https://github.com/nxt-website/nxt-cloud-chat/blob/main/admin/model/nxtcc-history-handler.php) (History actions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_messaging["Inbox and messaging"]
  node_admin["Admin workspace"]
  node_chat["Inbox handlers"]
  node_conversations["Conversation service"]
  node_message_api["WhatsApp API"]
  node_history_handler["History actions"]
  node_history_repo["History repository"]
  node_csv["CSV helpers"]
end

subgraph group_crm["CRM workspace"]
  node_contacts["Contact management"]
  node_deals["Sales pipelines"]
  node_groups["Contact groups"]
  node_tags["Contact tags"]
  node_tasks["Follow-up tasks"]
  node_teams["Team access"]
  node_dashboard["Dashboard"]
end

subgraph group_identity["Authentication"]
  node_otp["OTP workflow"]
  node_auth_dao["Auth data access"]
  node_login_widget["Login widget"]
  node_migration_gate["Verification gate<br/>[gate.php]"]
  node_bindings[("Binding repository")]
  node_auth_policy[("Auth policy<br/>[options.php]")]
end

subgraph group_platform["WordPress runtime"]
  node_route_bootstrap["Route bootstrap<br/>[routes.php]"]
  node_routes["Admin routes"]
  node_rest["REST API<br/>[rest-api.php]"]
  node_db[("Plugin database<br/>[class-nxtcc-db.php]")]
end

node_user(("WordPress user"))
node_meta{{"Meta Cloud API"}}

node_admin -->|"manages chats"| node_chat
node_chat -.->|"handles conversations"| node_conversations
node_conversations -.->|"sends messages"| node_message_api
node_message_api -->|"sends messages"| node_meta
node_meta -->|"delivers events"| node_conversations
node_admin -->|"reviews history"| node_history_handler
node_history_handler -->|"queries history"| node_history_repo
node_history_handler -->|"builds exports"| node_csv
node_admin -->|"manages contacts"| node_contacts
node_admin -->|"tracks deals"| node_deals
node_admin -->|"manages groups"| node_groups
node_admin -->|"manages tags"| node_tags
node_admin -->|"manages follow-ups"| node_tasks
node_admin -->|"sets access scopes"| node_teams
node_admin -->|"views reporting"| node_dashboard
node_user -->|"requests login"| node_login_widget
node_login_widget -.->|"requests verification"| node_otp
node_otp -->|"stores OTP data"| node_auth_dao
node_otp -->|"sends OTP"| node_meta
node_otp -->|"verifies and logs in"| node_user
node_migration_gate -->|"checks bindings"| node_bindings
node_migration_gate -->|"reads policy"| node_auth_policy
node_route_bootstrap -->|"initializes routes"| node_routes
node_route_bootstrap -->|"loads REST API"| node_rest
node_route_bootstrap -->|"loads database"| node_db

click node_admin "https://github.com/nxt-website/nxt-cloud-chat/tree/main/admin/pages"
click node_chat "https://github.com/nxt-website/nxt-cloud-chat/tree/main/admin/model/chat"
click node_conversations "https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/class-nxtcc-conversations.php"
click node_message_api "https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/nxtcc-send-message.php"
click node_history_handler "https://github.com/nxt-website/nxt-cloud-chat/blob/main/admin/model/nxtcc-history-handler.php"
click node_history_repo "https://github.com/nxt-website/nxt-cloud-chat/blob/main/admin/model/class-nxtcc-history-repo.php"
click node_csv "https://github.com/nxt-website/nxt-cloud-chat/blob/main/admin/model/nxtcc-csv-helpers.php"
click node_contacts "https://github.com/nxt-website/nxt-cloud-chat/tree/main/admin/model/contacts"
click node_deals "https://github.com/nxt-website/nxt-cloud-chat/blob/main/admin/model/nxtcc-deals-handler.php"
click node_groups "https://github.com/nxt-website/nxt-cloud-chat/tree/main/admin/model/groups"
click node_tags "https://github.com/nxt-website/nxt-cloud-chat/blob/main/admin/model/nxtcc-tags-handler.php"
click node_tasks "https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/class-nxtcc-crm-tasks.php"
click node_teams "https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/class-nxtcc-access-teams.php"
click node_dashboard "https://github.com/nxt-website/nxt-cloud-chat/blob/main/admin/model/class-nxtcc-dashboard-handler.php"
click node_otp "https://github.com/nxt-website/nxt-cloud-chat/blob/main/admin/model/nxtcc-auth-handler.php"
click node_auth_dao "https://github.com/nxt-website/nxt-cloud-chat/blob/main/admin/model/class-nxtcc-auth-dao.php"
click node_login_widget "https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/widgets/class-nxtcc-login-whatsapp-widget.php"
click node_migration_gate "https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/force-migration/gate.php"
click node_bindings "https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/force-migration/class-nxtcc-auth-bindings-repo.php"
click node_auth_policy "https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/force-migration/options.php"
click node_route_bootstrap "https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/routes.php"
click node_routes "https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/class-nxtcc-routes.php"
click node_rest "https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/rest-api.php"
click node_db "https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/class-nxtcc-db.php"

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_admin,node_chat,node_conversations,node_message_api,node_history_handler,node_history_repo,node_csv,node_user toneBlue
class node_contacts,node_deals,node_groups,node_tags,node_tasks,node_teams,node_dashboard toneAmber
class node_otp,node_auth_dao,node_login_widget,node_migration_gate,node_bindings,node_auth_policy,node_meta toneMint
class node_route_bootstrap,node_routes,node_rest,node_db toneRose
```

## Components

### Inbox and messaging

- [Admin workspace](https://github.com/nxt-website/nxt-cloud-chat/tree/main/admin/pages): `admin/pages`
- [Inbox handlers](https://github.com/nxt-website/nxt-cloud-chat/tree/main/admin/model/chat): `admin/model/chat`
- [Conversation service](https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/class-nxtcc-conversations.php): `includes/class-nxtcc-conversations.php`
- [WhatsApp API](https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/nxtcc-send-message.php): `includes/nxtcc-send-message.php`
- [History actions](https://github.com/nxt-website/nxt-cloud-chat/blob/main/admin/model/nxtcc-history-handler.php): `admin/model/nxtcc-history-handler.php`
- [History repository](https://github.com/nxt-website/nxt-cloud-chat/blob/main/admin/model/class-nxtcc-history-repo.php): `admin/model/class-nxtcc-history-repo.php`
- [CSV helpers](https://github.com/nxt-website/nxt-cloud-chat/blob/main/admin/model/nxtcc-csv-helpers.php): `admin/model/nxtcc-csv-helpers.php`

### CRM workspace

- [Contact management](https://github.com/nxt-website/nxt-cloud-chat/tree/main/admin/model/contacts): `admin/model/contacts`
- [Sales pipelines](https://github.com/nxt-website/nxt-cloud-chat/blob/main/admin/model/nxtcc-deals-handler.php): `admin/model/nxtcc-deals-handler.php`
- [Contact groups](https://github.com/nxt-website/nxt-cloud-chat/tree/main/admin/model/groups): `admin/model/groups`
- [Contact tags](https://github.com/nxt-website/nxt-cloud-chat/blob/main/admin/model/nxtcc-tags-handler.php): `admin/model/nxtcc-tags-handler.php`
- [Follow-up tasks](https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/class-nxtcc-crm-tasks.php): `includes/class-nxtcc-crm-tasks.php`
- [Team access](https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/class-nxtcc-access-teams.php): `includes/class-nxtcc-access-teams.php`
- [Dashboard](https://github.com/nxt-website/nxt-cloud-chat/blob/main/admin/model/class-nxtcc-dashboard-handler.php): `admin/model/class-nxtcc-dashboard-handler.php`

### Authentication

- [OTP workflow](https://github.com/nxt-website/nxt-cloud-chat/blob/main/admin/model/nxtcc-auth-handler.php): `admin/model/nxtcc-auth-handler.php`
- [Auth data access](https://github.com/nxt-website/nxt-cloud-chat/blob/main/admin/model/class-nxtcc-auth-dao.php): `admin/model/class-nxtcc-auth-dao.php`
- [Login widget](https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/widgets/class-nxtcc-login-whatsapp-widget.php): `includes/widgets/class-nxtcc-login-whatsapp-widget.php`
- [Verification gate](https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/force-migration/gate.php): `includes/force-migration/gate.php`
- [Binding repository](https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/force-migration/class-nxtcc-auth-bindings-repo.php): `includes/force-migration/class-nxtcc-auth-bindings-repo.php`
- [Auth policy](https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/force-migration/options.php): `includes/force-migration/options.php`

### WordPress runtime

- [Route bootstrap](https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/routes.php): `includes/routes.php`
- [Admin routes](https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/class-nxtcc-routes.php): `includes/class-nxtcc-routes.php`
- [REST API](https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/rest-api.php): `includes/rest-api.php`
- [Plugin database](https://github.com/nxt-website/nxt-cloud-chat/blob/main/includes/class-nxtcc-db.php): `includes/class-nxtcc-db.php`

### Other components

- **WordPress user**
- **Meta Cloud API**

## Connections

- Admin workspace → Inbox handlers: manages chats
- Inbox handlers → Conversation service: handles conversations
- Conversation service → WhatsApp API: sends messages
- WhatsApp API → Meta Cloud API: sends messages
- Meta Cloud API → Conversation service: delivers events
- Admin workspace → History actions: reviews history
- History actions → History repository: queries history (evidence: `admin/model/nxtcc-history-handler.php`)
- History actions → CSV helpers: builds exports (evidence: `admin/model/nxtcc-history-handler.php`)
- Admin workspace → Contact management: manages contacts
- Admin workspace → Sales pipelines: tracks deals
- Admin workspace → Contact groups: manages groups
- Admin workspace → Contact tags: manages tags
- Admin workspace → Follow-up tasks: manages follow-ups
- Admin workspace → Team access: sets access scopes
- Admin workspace → Dashboard: views reporting
- WordPress user → Login widget: requests login
- Login widget → OTP workflow: requests verification
- OTP workflow → Auth data access: stores OTP data (evidence: `admin/model/nxtcc-auth-handler.php`)
- OTP workflow → Meta Cloud API: sends OTP
- OTP workflow → WordPress user: verifies and logs in
- Verification gate → Binding repository: checks bindings (evidence: `includes/force-migration/gate.php`)
- Verification gate → Auth policy: reads policy (evidence: `includes/force-migration/options.php`)
- Route bootstrap → Admin routes: initializes routes (evidence: `includes/routes.php`)
- Route bootstrap → REST API: loads REST API (evidence: `includes/routes.php`)
- Route bootstrap → Plugin database: loads database (evidence: `includes/routes.php`)
