# basuki-rahmat/global-multi architecture

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

- Interactive diagram: https://gitdiagram.com/basuki-rahmat/global-multi
- Repository: https://github.com/basuki-rahmat/global-multi

## Overview

Multi Global is a multi-tenant business-application platform: prospective customers choose an application and submit an order, while platform and tenant administrators manage their respective scopes. The visible frontend also exposes admin login/order views and tenant customer-service configuration; the API provides authenticated order administration, password recovery, and AI chat. The excerpts show database, mail, and AI-provider integrations. Frontend and other unsampled routes are represented only at the enclosing module level; the README is empty.

Main entry points: [`server/src/app.js`](https://github.com/basuki-rahmat/global-multi/blob/main/server/src/app.js) (API routes), [`src/main.jsx`](https://github.com/basuki-rahmat/global-multi/blob/main/src/main.jsx) (Landing and admin UI), [`server/src/middleware/auth.js`](https://github.com/basuki-rahmat/global-multi/blob/main/server/src/middleware/auth.js) (JWT and role checks), [`server/src/config/db.js`](https://github.com/basuki-rahmat/global-multi/blob/main/server/src/config/db.js) (Database pool)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_web_app["Landing and admin UI<br/>[main.jsx]"]
end

subgraph group_api["API and access"]
  node_api_app["API routes<br/>[app.js]"]
  node_auth["JWT and role checks<br/>[auth.js]"]
  node_role_model["Role scopes<br/>[roles.js]"]
end

subgraph group_state["Platform state"]
  node_db_config["Database pool<br/>[db.js]"]
  node_mysql[("Platform data<br/>[schema.sql]")]
end

subgraph group_integrations["External services"]
  node_mailer["Transactional email<br/>[mailer.js]"]
  node_smtp["SMTP service"]
  node_ai_service["Customer-service AI<br/>[ai.js]"]
  node_ai_providers["Groq and OpenAI"]
end

node_prospective_customer(("Prospective customer"))
node_platform_admin(("Platform admin"))
node_tenant_admin(("Tenant admin"))

node_prospective_customer -->|"browses and orders"| node_web_app
node_platform_admin -->|"manages platform"| node_web_app
node_tenant_admin -->|"manages tenant"| node_web_app
node_web_app -->|"sends API requests"| node_api_app
node_api_app -->|"returns results"| node_web_app
node_api_app -->|"checks access"| node_auth
node_auth -->|"checks role"| node_role_model
node_api_app -->|"queries and updates"| node_db_config
node_db_config -->|"reads and writes"| node_mysql
node_api_app -->|"sends order and reset mail"| node_mailer
node_mailer -->|"delivers mail"| node_smtp
node_api_app -->|"requests chat reply"| node_ai_service
node_ai_service -.->|"requests completion"| node_ai_providers

click node_web_app "https://github.com/basuki-rahmat/global-multi/blob/main/src/main.jsx"
click node_api_app "https://github.com/basuki-rahmat/global-multi/blob/main/server/src/app.js"
click node_auth "https://github.com/basuki-rahmat/global-multi/blob/main/server/src/middleware/auth.js"
click node_role_model "https://github.com/basuki-rahmat/global-multi/blob/main/server/src/config/roles.js"
click node_db_config "https://github.com/basuki-rahmat/global-multi/blob/main/server/src/config/db.js"
click node_mysql "https://github.com/basuki-rahmat/global-multi/blob/main/database/schema.sql"
click node_mailer "https://github.com/basuki-rahmat/global-multi/blob/main/server/src/services/mailer.js"
click node_ai_service "https://github.com/basuki-rahmat/global-multi/blob/main/server/src/services/ai.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_web_app toneBlue
class node_api_app,node_auth,node_role_model toneAmber
class node_db_config,node_mysql toneMint
class node_mailer,node_smtp,node_ai_service,node_ai_providers toneRose
class node_prospective_customer,node_platform_admin,node_tenant_admin toneIndigo
```

## Components

### Web experience

- [Landing and admin UI](https://github.com/basuki-rahmat/global-multi/blob/main/src/main.jsx): `src/main.jsx`

### API and access

- [API routes](https://github.com/basuki-rahmat/global-multi/blob/main/server/src/app.js): `server/src/app.js`
- [JWT and role checks](https://github.com/basuki-rahmat/global-multi/blob/main/server/src/middleware/auth.js): `server/src/middleware/auth.js`
- [Role scopes](https://github.com/basuki-rahmat/global-multi/blob/main/server/src/config/roles.js): `server/src/config/roles.js`

### Platform state

- [Database pool](https://github.com/basuki-rahmat/global-multi/blob/main/server/src/config/db.js): `server/src/config/db.js`
- [Platform data](https://github.com/basuki-rahmat/global-multi/blob/main/database/schema.sql): `database/schema.sql`

### External services

- [Transactional email](https://github.com/basuki-rahmat/global-multi/blob/main/server/src/services/mailer.js): `server/src/services/mailer.js`
- **SMTP service**
- [Customer-service AI](https://github.com/basuki-rahmat/global-multi/blob/main/server/src/services/ai.js): `server/src/services/ai.js`
- **Groq and OpenAI**

### Other components

- **Prospective customer**
- **Platform admin**
- **Tenant admin**

## Connections

- Prospective customer → Landing and admin UI: browses and orders
- Platform admin → Landing and admin UI: manages platform
- Tenant admin → Landing and admin UI: manages tenant
- Landing and admin UI → API routes: sends API requests
- API routes → Landing and admin UI: returns results
- API routes → JWT and role checks: checks access
- JWT and role checks → Role scopes: checks role
- API routes → Database pool: queries and updates
- Database pool → Platform data: reads and writes
- API routes → Transactional email: sends order and reset mail
- Transactional email → SMTP service: delivers mail
- API routes → Customer-service AI: requests chat reply
- Customer-service AI → Groq and OpenAI: requests completion
