# nickjee86/jomkaki-crm architecture

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

- Interactive diagram: https://gitdiagram.com/nickjee86/jomkaki-crm
- Repository: https://github.com/nickjee86/jomkaki-crm

## Overview

JomKaki Rider CRM 2.0 is a role-scoped, Sheets-backed operations CRM. Staff and managers use its workspaces to manage leads and applications through document collection, consent, review and LMS readiness, while maintaining product catalogs and loan pricing. WhatsApp carries customer conversations: inbound messages feed CRM records and AI-assisted replies; follow-up automation and the outbox support controlled dispatch and recovery. The README documents reporting, audit, branch/team administration, SharePoint document integration and gated LMSPRO preparation. Sampled source excerpts are partial, so uncertain subsystem wiring is omitted.

Main entry points: [`api/crm.js`](https://github.com/nickjee86/jomkaki-crm/blob/main/api/crm.js) (CRM API), [`api/whatsapp-webhook.js`](https://github.com/nickjee86/jomkaki-crm/blob/main/api/whatsapp-webhook.js) (WhatsApp intake and AI), [`business-architecture.js`](https://github.com/nickjee86/jomkaki-crm/blob/main/business-architecture.js) (Applications and consent), [`app-v2.js`](https://github.com/nickjee86/jomkaki-crm/blob/main/app-v2.js) (CRM workspaces)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspaces["CRM Workspaces"]
  node_crm_ui["CRM workspaces<br/>[app-v2.js]"]
  node_catalog_ui["Product catalogs"]
  node_business_ui["Applications and consent"]
  node_reports["Reports and audit<br/>[crm.js]"]
end

subgraph group_operations["Sales Operations"]
  node_crm_api["CRM API<br/>[crm.js]"]
  node_identity["Session and access<br/>[_auth.js]"]
  node_motor["Motor and phone loans"]
  node_pricing["Approved loan pricing<br/>[crm.js]"]
end

subgraph group_messaging["Messaging Automation"]
  node_webhook["WhatsApp intake and AI"]
  node_knowledge["Approved AI knowledge"]
  node_outbox["Outbox dispatch"]
  node_followup["Follow-up scheduler"]
end

subgraph group_integrations["External Systems"]
  node_sheets[("Operations Sheets")]
  node_lms["LMSPRO integration<br/>[_lmspro.js]"]
  node_sharepoint[("SharePoint documents")]
  node_meta["WhatsApp Cloud API"]
  node_notion[("Notion knowledge base")]
end

node_staff(("CRM users"))
node_customer(("Customers"))
node_make["Make dispatcher"]

node_staff -->|"uses"| node_crm_ui
node_crm_ui -->|"requests CRM data"| node_crm_api
node_crm_api -->|"validates sessions"| node_identity
node_identity -->|"reads accounts"| node_sheets
node_crm_api -->|"reads and writes"| node_sheets
node_catalog_ui -->|"manages catalog"| node_crm_api
node_business_ui -->|"manages cases"| node_crm_api
node_crm_api -.->|"verifies document writes"| node_sharepoint
node_business_ui -.->|"prepares gated submission"| node_lms
node_business_ui -->|"supports loan workflows"| node_motor
node_crm_api -->|"serves approved pricing"| node_pricing
node_pricing -->|"reads pricing records"| node_sheets
node_customer -->|"sends messages"| node_meta
node_meta -->|"delivers webhook"| node_webhook
node_webhook -->|"retrieves relevant sections"| node_knowledge
node_webhook -->|"records conversations"| node_sheets
node_webhook -->|"sends replies"| node_meta
node_make -->|"dispatches queued messages"| node_outbox
node_outbox -->|"reads queued messages"| node_sheets
node_outbox -->|"sends approved messages"| node_meta
node_make -->|"runs scheduled checks"| node_followup
node_followup -->|"reads cases and logs activity"| node_sheets
node_followup -->|"sends eligible follow-ups"| node_meta
node_crm_ui -->|"views reports"| node_reports
node_reports -->|"reads operational records"| node_sheets
node_notion -.->|"supplies synced content"| node_knowledge

click node_crm_ui "https://github.com/nickjee86/jomkaki-crm/blob/main/app-v2.js"
click node_crm_api "https://github.com/nickjee86/jomkaki-crm/blob/main/api/crm.js"
click node_identity "https://github.com/nickjee86/jomkaki-crm/blob/main/api/_auth.js"
click node_catalog_ui "https://github.com/nickjee86/jomkaki-crm/blob/main/product-business.js"
click node_business_ui "https://github.com/nickjee86/jomkaki-crm/blob/main/business-architecture.js"
click node_motor "https://github.com/nickjee86/jomkaki-crm/blob/main/second-hand-motor.js"
click node_lms "https://github.com/nickjee86/jomkaki-crm/blob/main/api/_lmspro.js"
click node_webhook "https://github.com/nickjee86/jomkaki-crm/blob/main/api/whatsapp-webhook.js"
click node_knowledge "https://github.com/nickjee86/jomkaki-crm/blob/main/api/_jomkaki-knowledge.js"
click node_outbox "https://github.com/nickjee86/jomkaki-crm/blob/main/api/whatsapp-outbox-send.js"
click node_followup "https://github.com/nickjee86/jomkaki-crm/blob/main/api/follow-up-dispatch.js"
click node_reports "https://github.com/nickjee86/jomkaki-crm/blob/main/api/crm.js"
click node_pricing "https://github.com/nickjee86/jomkaki-crm/blob/main/api/crm.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_crm_ui,node_catalog_ui,node_business_ui,node_reports,node_staff toneBlue
class node_crm_api,node_identity,node_motor,node_pricing toneAmber
class node_webhook,node_knowledge,node_outbox,node_followup toneMint
class node_sheets,node_lms,node_sharepoint,node_meta,node_notion toneRose
class node_customer,node_make toneIndigo
```

## Components

### CRM Workspaces

- [CRM workspaces](https://github.com/nickjee86/jomkaki-crm/blob/main/app-v2.js): `app-v2.js`
- [Product catalogs](https://github.com/nickjee86/jomkaki-crm/blob/main/product-business.js): `product-business.js`
- [Applications and consent](https://github.com/nickjee86/jomkaki-crm/blob/main/business-architecture.js): `business-architecture.js`
- [Reports and audit](https://github.com/nickjee86/jomkaki-crm/blob/main/api/crm.js): `api/crm.js`

### Sales Operations

- [CRM API](https://github.com/nickjee86/jomkaki-crm/blob/main/api/crm.js): `api/crm.js`
- [Session and access](https://github.com/nickjee86/jomkaki-crm/blob/main/api/_auth.js): `api/_auth.js`
- [Motor and phone loans](https://github.com/nickjee86/jomkaki-crm/blob/main/second-hand-motor.js): `second-hand-motor.js`
- [Approved loan pricing](https://github.com/nickjee86/jomkaki-crm/blob/main/api/crm.js): `api/crm.js`

### Messaging Automation

- [WhatsApp intake and AI](https://github.com/nickjee86/jomkaki-crm/blob/main/api/whatsapp-webhook.js): `api/whatsapp-webhook.js`
- [Approved AI knowledge](https://github.com/nickjee86/jomkaki-crm/blob/main/api/_jomkaki-knowledge.js): `api/_jomkaki-knowledge.js`
- [Outbox dispatch](https://github.com/nickjee86/jomkaki-crm/blob/main/api/whatsapp-outbox-send.js): `api/whatsapp-outbox-send.js`
- [Follow-up scheduler](https://github.com/nickjee86/jomkaki-crm/blob/main/api/follow-up-dispatch.js): `api/follow-up-dispatch.js`

### External Systems

- **Operations Sheets**
- [LMSPRO integration](https://github.com/nickjee86/jomkaki-crm/blob/main/api/_lmspro.js): `api/_lmspro.js`
- **SharePoint documents**
- **WhatsApp Cloud API**
- **Notion knowledge base**

### Other components

- **CRM users**
- **Customers**
- **Make dispatcher**

## Connections

- CRM users → CRM workspaces: uses
- CRM workspaces → CRM API: requests CRM data
- CRM API → Session and access: validates sessions
- Session and access → Operations Sheets: reads accounts
- CRM API → Operations Sheets: reads and writes
- Product catalogs → CRM API: manages catalog
- Applications and consent → CRM API: manages cases
- CRM API → SharePoint documents: verifies document writes
- Applications and consent → LMSPRO integration: prepares gated submission
- Applications and consent → Motor and phone loans: supports loan workflows
- CRM API → Approved loan pricing: serves approved pricing
- Approved loan pricing → Operations Sheets: reads pricing records
- Customers → WhatsApp Cloud API: sends messages
- WhatsApp Cloud API → WhatsApp intake and AI: delivers webhook
- WhatsApp intake and AI → Approved AI knowledge: retrieves relevant sections
- WhatsApp intake and AI → Operations Sheets: records conversations
- WhatsApp intake and AI → WhatsApp Cloud API: sends replies
- Make dispatcher → Outbox dispatch: dispatches queued messages
- Outbox dispatch → Operations Sheets: reads queued messages
- Outbox dispatch → WhatsApp Cloud API: sends approved messages
- Make dispatcher → Follow-up scheduler: runs scheduled checks
- Follow-up scheduler → Operations Sheets: reads cases and logs activity
- Follow-up scheduler → WhatsApp Cloud API: sends eligible follow-ups
- CRM workspaces → Reports and audit: views reports
- Reports and audit → Operations Sheets: reads operational records
- Notion knowledge base → Approved AI knowledge: supplies synced content
