# hsalehs2005-cis/mala3bi-platform architecture

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

- Interactive diagram: https://gitdiagram.com/hsalehs2005-cis/mala3bi-platform
- Repository: https://github.com/hsalehs2005-cis/mala3bi-platform

## Overview

Mala3bi is a sports-field booking platform for players, field owners, academies, and administrators. Players discover fields and available slots, book and pay (or choose cash), and can use social booking rooms; owners and administrators manage listings, schedules, payments, and operations. The README documents broader capabilities than the sampled server excerpts, so those are represented at the documented subsystem level. Most REST workflows reside in the single large `src/Index.js`; the graph does not imply separate implementation modules for them.

Main entry points: [`src/Index.js`](https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/src/Index.js) (REST API), [`src/whatsapp.js`](https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/src/whatsapp.js) (WhatsApp messaging), [`public/index.html`](https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/public/index.html) (Player web app), [`public/Stadium admin.html`](https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/public/Stadium%20admin.html) (Owner dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web clients"]
  node_player_web["Player web app<br/>[index.html]"]
  node_owner_web["Owner dashboard<br/>[Stadium admin.html]"]
end

subgraph group_booking["Booking platform"]
  node_api["REST API<br/>[Index.js]"]
  node_identity["Accounts and access<br/>[Index.js]"]
  node_field_discovery["Field discovery<br/>[Index.js]"]
  node_booking_flow["Bookings and rooms<br/>[Index.js]"]
  node_payments["Payment processing<br/>[Index.js]"]
  node_academy["Academy subscriptions<br/>[Index.js]"]
end

subgraph group_management["Management"]
  node_owner_ops["Field operations<br/>[Index.js]"]
  node_admin_ops["Platform administration<br/>[Index.js]"]
  node_database[("MySQL data<br/>[schema.sql]")]
end

subgraph group_messaging["Messaging"]
  node_whatsapp["WhatsApp messaging<br/>[whatsapp.js]"]
  node_email["Email delivery<br/>[Email.js]"]
end

node_players(("Players"))
node_owners(("Stadium owners"))
node_admins(("Administrators"))
node_moyasar{{"Moyasar"}}
node_meta{{"WhatsApp Cloud API"}}
node_resend{{"Resend"}}

node_players -->|"use"| node_player_web
node_owners -->|"manage fields"| node_owner_web
node_admins -->|"administer"| node_player_web
node_player_web -->|"requests"| node_api
node_owner_web -->|"requests"| node_api
node_api -->|"handles access"| node_identity
node_api -->|"serves discovery"| node_field_discovery
node_api -->|"handles booking"| node_booking_flow
node_api -->|"handles payment"| node_payments
node_api -->|"serves subscriptions"| node_academy
node_api -->|"serves operations"| node_owner_ops
node_api -->|"serves administration"| node_admin_ops
node_api -->|"queries data"| node_database
node_payments -->|"verifies payments"| node_moyasar
node_api -->|"invokes"| node_whatsapp
node_api -->|"invokes"| node_email
node_whatsapp -->|"reads booking data"| node_database
node_whatsapp -->|"sends messages"| node_meta
node_email -->|"sends email"| node_resend

click node_player_web "https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/public/index.html"
click node_owner_web "https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/public/Stadium%20admin.html"
click node_api "https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/src/Index.js"
click node_identity "https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/src/Index.js"
click node_field_discovery "https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/src/Index.js"
click node_booking_flow "https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/src/Index.js"
click node_payments "https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/src/Index.js"
click node_academy "https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/src/Index.js"
click node_owner_ops "https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/src/Index.js"
click node_admin_ops "https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/src/Index.js"
click node_database "https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/database/schema.sql"
click node_whatsapp "https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/src/whatsapp.js"
click node_email "https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/src/Email.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_player_web,node_owner_web toneBlue
class node_api,node_identity,node_field_discovery,node_booking_flow,node_payments,node_academy toneAmber
class node_owner_ops,node_admin_ops,node_database,node_meta toneMint
class node_whatsapp,node_email toneRose
class node_players,node_owners,node_admins,node_moyasar,node_resend toneIndigo
```

## Components

### Web clients

- [Player web app](https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/public/index.html): `public/index.html`
- [Owner dashboard](https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/public/Stadium%20admin.html): `public/Stadium admin.html`

### Booking platform

- [REST API](https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/src/Index.js): `src/Index.js`
- [Accounts and access](https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/src/Index.js): `src/Index.js`
- [Field discovery](https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/src/Index.js): `src/Index.js`
- [Bookings and rooms](https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/src/Index.js): `src/Index.js`
- [Payment processing](https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/src/Index.js): `src/Index.js`
- [Academy subscriptions](https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/src/Index.js): `src/Index.js`

### Management

- [Field operations](https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/src/Index.js): `src/Index.js`
- [Platform administration](https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/src/Index.js): `src/Index.js`
- [MySQL data](https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/database/schema.sql): `database/schema.sql`

### Messaging

- [WhatsApp messaging](https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/src/whatsapp.js): `src/whatsapp.js`
- [Email delivery](https://github.com/hsalehs2005-cis/mala3bi-platform/blob/main/src/Email.js): `src/Email.js`

### Other components

- **Players**
- **Stadium owners**
- **Administrators**
- **Moyasar**
- **WhatsApp Cloud API**
- **Resend**

## Connections

- Players → Player web app: use (evidence: `README.md`)
- Stadium owners → Owner dashboard: manage fields (evidence: `README.md`)
- Administrators → Player web app: administer (evidence: `README.md`)
- Player web app → REST API: requests (evidence: `README.md`)
- Owner dashboard → REST API: requests (evidence: `README.md`)
- REST API → Accounts and access: handles access (evidence: `README.md`)
- REST API → Field discovery: serves discovery (evidence: `README.md`)
- REST API → Bookings and rooms: handles booking (evidence: `README.md`)
- REST API → Payment processing: handles payment (evidence: `README.md`)
- REST API → Academy subscriptions: serves subscriptions (evidence: `README.md`)
- REST API → Field operations: serves operations (evidence: `README.md`)
- REST API → Platform administration: serves administration (evidence: `README.md`)
- REST API → MySQL data: queries data (evidence: `src/Index.js`)
- Payment processing → Moyasar: verifies payments (evidence: `README.md`)
- REST API → WhatsApp messaging: invokes (evidence: `src/Index.js`)
- REST API → Email delivery: invokes (evidence: `src/Index.js`)
- WhatsApp messaging → MySQL data: reads booking data (evidence: `src/whatsapp.js`)
- WhatsApp messaging → WhatsApp Cloud API: sends messages (evidence: `src/whatsapp.js`)
- Email delivery → Resend: sends email (evidence: `src/Email.js`)
