# dhiliprn/customer-engagement-platform architecture

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

- Interactive diagram: https://gitdiagram.com/dhiliprn/customer-engagement-platform
- Repository: https://github.com/dhiliprn/customer-engagement-platform

## Overview

Customer Engagement Platform provides a browser-based console and authenticated API for managing businesses, customers, purchases, message templates, campaigns, messages, appointments, and review automations. Users sign in, select business data, and manage these capabilities through the UI; the API validates access and persists records in Supabase. Backend workers process scheduled messages, campaigns, and appointment reminders. WhatsApp delivery is explicitly simulated in this phase. Route-to-service links are supported by the source index and excerpts; unsampled implementation details are not assumed.

Main entry points: [`frontend/src/App.jsx`](https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/App.jsx) (Console application), [`backend/src/app.js`](https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/app.js) (HTTP API), [`backend/src/routes/purchases.js`](https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/routes/purchases.js) (Purchase routes), [`backend/src/routes/messages.js`](https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/routes/messages.js) (Message routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web console"]
  node_app["Console application<br/>[App.jsx]"]
  node_login["Sign-in<br/>[Login.jsx]"]
  node_api_client["API client<br/>[api.js]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_business_ui["Business management<br/>[Businesses.jsx]"]
  node_customer_ui["Customer management<br/>[Customers.jsx]"]
  node_purchase_ui["Purchase management<br/>[Purchases.jsx]"]
  node_template_ui["Message templates"]
  node_campaign_ui["Campaign management<br/>[Campaigns.jsx]"]
  node_message_ui["Message management<br/>[Messages.jsx]"]
  node_appointment_ui["Appointment management<br/>[Appointments.jsx]"]
  node_review_ui["Review automation"]
  node_profile_ui["User profiles<br/>[UserProfiles.jsx]"]
  node_auth_client["Supabase auth client<br/>[supabaseClient.js]"]
end

subgraph group_api["API and access"]
  node_http_api["HTTP API<br/>[app.js]"]
  node_auth["Authentication and access<br/>[auth.js]"]
  node_business_routes["Business routes<br/>[businesses.js]"]
  node_customer_routes["Customer routes<br/>[customers.js]"]
  node_purchase_routes["Purchase routes<br/>[purchases.js]"]
  node_template_routes["Template routes"]
  node_campaign_routes["Campaign routes<br/>[campaigns.js]"]
  node_message_routes["Message routes<br/>[messages.js]"]
  node_appointment_routes["Appointment routes<br/>[Appointments.js]"]
  node_review_routes["Review routes"]
  node_profile_routes["Profile routes<br/>[userProfiles.js]"]
end

subgraph group_domain["Engagement services"]
  node_business_service["Business records<br/>[businesses.js]"]
  node_customer_service["Customer records<br/>[customers.js]"]
  node_purchase_service["Purchase records<br/>[purchases.js]"]
  node_template_service["Template records"]
  node_campaign_service["Campaign records<br/>[campaigns.js]"]
  node_message_service["Message records<br/>[messages.js]"]
  node_appointment_service["Appointment records<br/>[Appointments.js]"]
  node_review_service["Review automation records"]
end

subgraph group_runtime["Persistence and workers"]
end

node_user(("Console user"))

node_user -->|"uses"| node_app
node_app -->|"renders"| node_login
node_app -->|"calls"| node_api_client
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_business_ui
node_app -->|"renders"| node_customer_ui
node_app -->|"renders"| node_purchase_ui
node_app -->|"renders"| node_template_ui
node_app -->|"renders"| node_campaign_ui
node_app -->|"renders"| node_message_ui
node_app -->|"renders"| node_appointment_ui
node_app -->|"renders"| node_review_ui
node_app -->|"renders"| node_profile_ui
node_app -->|"checks session"| node_auth_client
node_login -->|"authenticates"| node_auth_client
node_api_client -->|"gets token"| node_auth_client
node_api_client -->|"sends requests"| node_http_api
node_http_api -->|"applies"| node_auth
node_http_api -->|"mounts"| node_business_routes
node_http_api -->|"mounts"| node_customer_routes
node_http_api -->|"mounts"| node_purchase_routes
node_http_api -->|"mounts"| node_template_routes
node_http_api -->|"mounts"| node_campaign_routes
node_http_api -->|"mounts"| node_message_routes
node_http_api -->|"mounts"| node_appointment_routes
node_http_api -->|"mounts"| node_review_routes
node_http_api -->|"mounts"| node_profile_routes
node_business_routes -.->|"calls"| node_business_service
node_customer_routes -->|"calls"| node_customer_service
node_customer_routes -->|"validates business"| node_business_service
node_purchase_routes -->|"calls"| node_purchase_service
node_purchase_routes -->|"calls"| node_customer_service
node_purchase_routes -->|"validates business"| node_business_service
node_purchase_routes -->|"calls"| node_review_service
node_purchase_routes -->|"calls"| node_template_service
node_purchase_routes -->|"calls"| node_message_service
node_template_routes -->|"calls"| node_template_service
node_template_routes -->|"validates business"| node_business_service
node_campaign_routes -->|"calls"| node_campaign_service
node_campaign_routes -->|"validates business"| node_business_service
node_campaign_routes -->|"calls"| node_template_service
node_message_routes -->|"calls"| node_message_service
node_message_routes -->|"calls"| node_business_service
node_message_routes -->|"calls"| node_customer_service
node_message_routes -->|"calls"| node_campaign_service
node_message_routes -->|"calls"| node_template_service
node_appointment_routes -->|"calls"| node_appointment_service
node_appointment_routes -->|"calls"| node_business_service

click node_app "https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/App.jsx"
click node_login "https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/Login.jsx"
click node_api_client "https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/api.js"
click node_dashboard "https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/UI_Pages/Dashboard.jsx"
click node_business_ui "https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/UI_Pages/Businesses.jsx"
click node_customer_ui "https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/UI_Pages/Customers.jsx"
click node_purchase_ui "https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/UI_Pages/Purchases.jsx"
click node_template_ui "https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/UI_Pages/MessageTemplates.jsx"
click node_campaign_ui "https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/UI_Pages/Campaigns.jsx"
click node_message_ui "https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/UI_Pages/Messages.jsx"
click node_appointment_ui "https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/UI_Pages/Appointments.jsx"
click node_review_ui "https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/UI_Pages/ReviewAutomation.jsx"
click node_profile_ui "https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/UI_Pages/UserProfiles.jsx"
click node_auth_client "https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/supabaseClient.js"
click node_http_api "https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/app.js"
click node_auth "https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/middleware/auth.js"
click node_business_routes "https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/routes/businesses.js"
click node_customer_routes "https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/routes/customers.js"
click node_purchase_routes "https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/routes/purchases.js"
click node_template_routes "https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/routes/messageTemplates.js"
click node_campaign_routes "https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/routes/campaigns.js"
click node_message_routes "https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/routes/messages.js"
click node_appointment_routes "https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/routes/Appointments.js"
click node_review_routes "https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/routes/reviewAutomations.js"
click node_profile_routes "https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/routes/userProfiles.js"
click node_business_service "https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/services/businesses.js"
click node_customer_service "https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/services/customers.js"
click node_purchase_service "https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/services/purchases.js"
click node_template_service "https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/services/messageTemplates.js"
click node_campaign_service "https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/services/campaigns.js"
click node_message_service "https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/services/messages.js"
click node_appointment_service "https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/services/Appointments.js"
click node_review_service "https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/services/reviewAutomations.js"

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_app,node_login,node_api_client,node_dashboard,node_business_ui,node_customer_ui,node_purchase_ui,node_template_ui,node_campaign_ui,node_message_ui,node_appointment_ui,node_review_ui,node_profile_ui,node_auth_client,node_user toneBlue
class node_http_api,node_auth,node_business_routes,node_customer_routes,node_purchase_routes,node_template_routes,node_campaign_routes,node_message_routes,node_appointment_routes,node_review_routes,node_profile_routes toneAmber
class node_business_service,node_customer_service,node_purchase_service,node_template_service,node_campaign_service,node_message_service,node_appointment_service,node_review_service toneMint
```

## Components

### Web console

- [Console application](https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Sign-in](https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/Login.jsx): `frontend/src/Login.jsx`
- [API client](https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/api.js): `frontend/src/api.js`
- [Dashboard](https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/UI_Pages/Dashboard.jsx): `frontend/src/UI_Pages/Dashboard.jsx`
- [Business management](https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/UI_Pages/Businesses.jsx): `frontend/src/UI_Pages/Businesses.jsx`
- [Customer management](https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/UI_Pages/Customers.jsx): `frontend/src/UI_Pages/Customers.jsx`
- [Purchase management](https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/UI_Pages/Purchases.jsx): `frontend/src/UI_Pages/Purchases.jsx`
- [Message templates](https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/UI_Pages/MessageTemplates.jsx): `frontend/src/UI_Pages/MessageTemplates.jsx`
- [Campaign management](https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/UI_Pages/Campaigns.jsx): `frontend/src/UI_Pages/Campaigns.jsx`
- [Message management](https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/UI_Pages/Messages.jsx): `frontend/src/UI_Pages/Messages.jsx`
- [Appointment management](https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/UI_Pages/Appointments.jsx): `frontend/src/UI_Pages/Appointments.jsx`
- [Review automation](https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/UI_Pages/ReviewAutomation.jsx): `frontend/src/UI_Pages/ReviewAutomation.jsx`
- [User profiles](https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/UI_Pages/UserProfiles.jsx): `frontend/src/UI_Pages/UserProfiles.jsx`
- [Supabase auth client](https://github.com/dhiliprn/customer-engagement-platform/blob/main/frontend/src/supabaseClient.js): `frontend/src/supabaseClient.js`

### API and access

- [HTTP API](https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/app.js): `backend/src/app.js`
- [Authentication and access](https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/middleware/auth.js): `backend/src/middleware/auth.js`
- [Business routes](https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/routes/businesses.js): `backend/src/routes/businesses.js`
- [Customer routes](https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/routes/customers.js): `backend/src/routes/customers.js`
- [Purchase routes](https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/routes/purchases.js): `backend/src/routes/purchases.js`
- [Template routes](https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/routes/messageTemplates.js): `backend/src/routes/messageTemplates.js`
- [Campaign routes](https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/routes/campaigns.js): `backend/src/routes/campaigns.js`
- [Message routes](https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/routes/messages.js): `backend/src/routes/messages.js`
- [Appointment routes](https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/routes/Appointments.js): `backend/src/routes/Appointments.js`
- [Review routes](https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/routes/reviewAutomations.js): `backend/src/routes/reviewAutomations.js`
- [Profile routes](https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/routes/userProfiles.js): `backend/src/routes/userProfiles.js`

### Engagement services

- [Business records](https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/services/businesses.js): `backend/src/services/businesses.js`
- [Customer records](https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/services/customers.js): `backend/src/services/customers.js`
- [Purchase records](https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/services/purchases.js): `backend/src/services/purchases.js`
- [Template records](https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/services/messageTemplates.js): `backend/src/services/messageTemplates.js`
- [Campaign records](https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/services/campaigns.js): `backend/src/services/campaigns.js`
- [Message records](https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/services/messages.js): `backend/src/services/messages.js`
- [Appointment records](https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/services/Appointments.js): `backend/src/services/Appointments.js`
- [Review automation records](https://github.com/dhiliprn/customer-engagement-platform/blob/main/backend/src/services/reviewAutomations.js): `backend/src/services/reviewAutomations.js`

### Other components

- **Console user**

## Connections

- Console user → Console application: uses
- Console application → Sign-in: renders (evidence: `frontend/src/App.jsx`)
- Console application → API client: calls (evidence: `frontend/src/App.jsx`)
- Console application → Dashboard: renders (evidence: `frontend/src/App.jsx`)
- Console application → Business management: renders (evidence: `frontend/src/App.jsx`)
- Console application → Customer management: renders (evidence: `frontend/src/App.jsx`)
- Console application → Purchase management: renders (evidence: `frontend/src/App.jsx`)
- Console application → Message templates: renders (evidence: `frontend/src/App.jsx`)
- Console application → Campaign management: renders (evidence: `frontend/src/App.jsx`)
- Console application → Message management: renders (evidence: `frontend/src/App.jsx`)
- Console application → Appointment management: renders (evidence: `frontend/src/App.jsx`)
- Console application → Review automation: renders (evidence: `frontend/src/App.jsx`)
- Console application → User profiles: renders (evidence: `frontend/src/App.jsx`)
- Console application → Supabase auth client: checks session (evidence: `frontend/src/App.jsx`)
- Sign-in → Supabase auth client: authenticates (evidence: `frontend/src/Login.jsx`)
- API client → Supabase auth client: gets token (evidence: `frontend/src/api.js`)
- API client → HTTP API: sends requests
- HTTP API → Authentication and access: applies (evidence: `backend/src/app.js`)
- HTTP API → Business routes: mounts (evidence: `backend/src/app.js`)
- HTTP API → Customer routes: mounts (evidence: `backend/src/app.js`)
- HTTP API → Purchase routes: mounts (evidence: `backend/src/app.js`)
- HTTP API → Template routes: mounts (evidence: `backend/src/app.js`)
- HTTP API → Campaign routes: mounts (evidence: `backend/src/app.js`)
- HTTP API → Message routes: mounts (evidence: `backend/src/app.js`)
- HTTP API → Appointment routes: mounts (evidence: `backend/src/app.js`)
- HTTP API → Review routes: mounts (evidence: `backend/src/app.js`)
- HTTP API → Profile routes: mounts (evidence: `backend/src/app.js`)
- Business routes → Business records: calls
- Customer routes → Customer records: calls (evidence: `backend/src/routes/customers.js`)
- Customer routes → Business records: validates business (evidence: `backend/src/routes/customers.js`)
- Purchase routes → Purchase records: calls (evidence: `backend/src/routes/purchases.js`)
- Purchase routes → Customer records: calls (evidence: `backend/src/routes/purchases.js`)
- Purchase routes → Business records: validates business (evidence: `backend/src/routes/purchases.js`)
- Purchase routes → Review automation records: calls (evidence: `backend/src/routes/purchases.js`)
- Purchase routes → Template records: calls (evidence: `backend/src/routes/purchases.js`)
- Purchase routes → Message records: calls (evidence: `backend/src/routes/purchases.js`)
- Template routes → Template records: calls (evidence: `backend/src/routes/messageTemplates.js`)
- Template routes → Business records: validates business (evidence: `backend/src/routes/messageTemplates.js`)
- Campaign routes → Campaign records: calls (evidence: `backend/src/routes/campaigns.js`)
- Campaign routes → Business records: validates business (evidence: `backend/src/routes/campaigns.js`)
- Campaign routes → Template records: calls (evidence: `backend/src/routes/campaigns.js`)
- Message routes → Message records: calls (evidence: `backend/src/routes/messages.js`)
- Message routes → Business records: calls (evidence: `backend/src/routes/messages.js`)
- Message routes → Customer records: calls (evidence: `backend/src/routes/messages.js`)
- Message routes → Campaign records: calls (evidence: `backend/src/routes/messages.js`)
- Message routes → Template records: calls (evidence: `backend/src/routes/messages.js`)
- Appointment routes → Appointment records: calls (evidence: `backend/src/routes/Appointments.js`)
- Appointment routes → Business records: calls (evidence: `backend/src/routes/Appointments.js`)
