# ijoben/mlmku architecture

> Architecture diagram of the GitHub repository ijoben/mlmku, 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/ijoben/mlmku
- Repository: https://github.com/ijoben/mlmku

## Overview

HEDTRO is a browser-based membership, ordering, payment, and referral-bonus platform. Members register or sign in, manage their account, and can pay for orders; server-side payment handling records payment and invokes bonus distribution. Admins can approve orders and run a bonus backfill. The tree documents the page and function boundaries, while sampled excerpts confirm Supabase access, payment handling, and bonus logic. Several HTML page-to-function calls are not shown, so those links are omitted.

Main entry points: [`supabase.js`](https://github.com/ijoben/mlmku/blob/main/supabase.js) (Browser data client), [`supabase`](https://github.com/ijoben/mlmku/tree/main/supabase) (Supabase data), [`supabase/functions/payment-gateway/index.ts`](https://github.com/ijoben/mlmku/blob/main/supabase/functions/payment-gateway/index.ts) (Payment gateway), [`register.html`](https://github.com/ijoben/mlmku/blob/main/register.html) (Registration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_member["Member experience"]
  node_register["Registration<br/>[register.html]"]
  node_login["Sign in<br/>[login.html]"]
  node_confirm["Email confirmation<br/>[confirm-email.html]"]
  node_reset["Password reset"]
  node_dashboard["Member dashboard<br/>[dashboard.html]"]
  node_simulation["Simulation<br/>[simulasi.html]"]
  node_adminpage["Admin console<br/>[admin.html]"]
end

subgraph group_commerce["Orders and payments"]
  node_orders["Order helpers<br/>[supabase.js]"]
  node_paymentpage["Payment page<br/>[payment.html]"]
  node_gateway["Payment gateway<br/>[index.ts]"]
end

subgraph group_rewards["Referral rewards"]
  node_distribute["Bonus distribution<br/>[index.ts]"]
  node_backfill["Bonus backfill<br/>[index.ts]"]
  node_backfillpage["Backfill admin page"]
end

subgraph group_backend["Supabase backend"]
  node_client["Browser data client<br/>[supabase.js]"]
  node_database[("Supabase data")]
  node_storage[("Image storage<br/>[supabase.js]")]
end

node_member(("Member"))
node_admin(("Admin"))
node_tripay["Tripay"]

node_member -->|"registers"| node_register
node_member -->|"signs in"| node_login
node_member -->|"uses account"| node_dashboard
node_member -->|"pays order"| node_paymentpage
node_admin -->|"manages platform"| node_adminpage
node_admin -->|"runs audit"| node_backfillpage
node_register -->|"uses client"| node_client
node_login -->|"uses client"| node_client
node_confirm -->|"uses client"| node_client
node_reset -->|"uses client"| node_client
node_dashboard -->|"loads account"| node_client
node_simulation -->|"uses client"| node_client
node_adminpage -->|"uses client"| node_client
node_client -->|"reads and writes"| node_database
node_client -->|"uploads and removes"| node_storage
node_orders -->|"uses client"| node_client
node_gateway -->|"reads and writes"| node_database
node_gateway -.->|"requests payment"| node_tripay
node_gateway -->|"invokes after payment"| node_distribute
node_distribute -->|"reads and updates"| node_database
node_backfillpage -->|"invokes"| node_backfill
node_backfill -->|"audits and updates"| node_database

click node_register "https://github.com/ijoben/mlmku/blob/main/register.html"
click node_login "https://github.com/ijoben/mlmku/blob/main/login.html"
click node_confirm "https://github.com/ijoben/mlmku/blob/main/confirm-email.html"
click node_reset "https://github.com/ijoben/mlmku/blob/main/reset-password.html"
click node_dashboard "https://github.com/ijoben/mlmku/blob/main/dashboard.html"
click node_simulation "https://github.com/ijoben/mlmku/blob/main/simulasi.html"
click node_adminpage "https://github.com/ijoben/mlmku/blob/main/admin.html"
click node_orders "https://github.com/ijoben/mlmku/blob/main/supabase.js"
click node_paymentpage "https://github.com/ijoben/mlmku/blob/main/payment.html"
click node_gateway "https://github.com/ijoben/mlmku/blob/main/supabase/functions/payment-gateway/index.ts"
click node_client "https://github.com/ijoben/mlmku/blob/main/supabase.js"
click node_database "https://github.com/ijoben/mlmku/tree/main/supabase"
click node_storage "https://github.com/ijoben/mlmku/blob/main/supabase.js"
click node_distribute "https://github.com/ijoben/mlmku/blob/main/supabase/functions/distribute-bonus/index.ts"
click node_backfill "https://github.com/ijoben/mlmku/blob/main/supabase/functions/backfill-bonus/index.ts"
click node_backfillpage "https://github.com/ijoben/mlmku/blob/main/backfill-bonus.html"

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_register,node_login,node_confirm,node_reset,node_dashboard,node_simulation,node_adminpage toneBlue
class node_orders,node_paymentpage,node_gateway toneAmber
class node_distribute,node_backfill,node_backfillpage toneMint
class node_client,node_database,node_storage toneRose
class node_member,node_admin,node_tripay toneIndigo
```

## Components

### Member experience

- [Registration](https://github.com/ijoben/mlmku/blob/main/register.html): `register.html`
- [Sign in](https://github.com/ijoben/mlmku/blob/main/login.html): `login.html`
- [Email confirmation](https://github.com/ijoben/mlmku/blob/main/confirm-email.html): `confirm-email.html`
- [Password reset](https://github.com/ijoben/mlmku/blob/main/reset-password.html): `reset-password.html`
- [Member dashboard](https://github.com/ijoben/mlmku/blob/main/dashboard.html): `dashboard.html`
- [Simulation](https://github.com/ijoben/mlmku/blob/main/simulasi.html): `simulasi.html`
- [Admin console](https://github.com/ijoben/mlmku/blob/main/admin.html): `admin.html`

### Orders and payments

- [Order helpers](https://github.com/ijoben/mlmku/blob/main/supabase.js): `supabase.js`
- [Payment page](https://github.com/ijoben/mlmku/blob/main/payment.html): `payment.html`
- [Payment gateway](https://github.com/ijoben/mlmku/blob/main/supabase/functions/payment-gateway/index.ts): `supabase/functions/payment-gateway/index.ts`

### Referral rewards

- [Bonus distribution](https://github.com/ijoben/mlmku/blob/main/supabase/functions/distribute-bonus/index.ts): `supabase/functions/distribute-bonus/index.ts`
- [Bonus backfill](https://github.com/ijoben/mlmku/blob/main/supabase/functions/backfill-bonus/index.ts): `supabase/functions/backfill-bonus/index.ts`
- [Backfill admin page](https://github.com/ijoben/mlmku/blob/main/backfill-bonus.html): `backfill-bonus.html`

### Supabase backend

- [Browser data client](https://github.com/ijoben/mlmku/blob/main/supabase.js): `supabase.js`
- [Supabase data](https://github.com/ijoben/mlmku/tree/main/supabase): `supabase`
- [Image storage](https://github.com/ijoben/mlmku/blob/main/supabase.js): `supabase.js`

### Other components

- **Member**
- **Admin**
- **Tripay**

## Connections

- Member → Registration: registers
- Member → Sign in: signs in
- Member → Member dashboard: uses account
- Member → Payment page: pays order
- Admin → Admin console: manages platform
- Admin → Backfill admin page: runs audit
- Registration → Browser data client: uses client
- Sign in → Browser data client: uses client
- Email confirmation → Browser data client: uses client
- Password reset → Browser data client: uses client
- Member dashboard → Browser data client: loads account
- Simulation → Browser data client: uses client
- Admin console → Browser data client: uses client
- Browser data client → Supabase data: reads and writes
- Browser data client → Image storage: uploads and removes
- Order helpers → Browser data client: uses client
- Payment gateway → Supabase data: reads and writes
- Payment gateway → Tripay: requests payment
- Payment gateway → Bonus distribution: invokes after payment
- Bonus distribution → Supabase data: reads and updates
- Backfill admin page → Bonus backfill: invokes
- Bonus backfill → Supabase data: audits and updates
