# macalouboubaa-lab/model_cv architecture

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

- Interactive diagram: https://gitdiagram.com/macalouboubaa-lab/model_cv
- Repository: https://github.com/macalouboubaa-lab/model_cv

## Overview

SAMA CV is a browser-based gallery and editor for 14 HTML CV templates. The main workflow is to open the gallery or a template, edit text and photos, save the work in browser storage, and print an A4 PDF. A separate, preparation-stage account and payment branch supports Supabase identities and manual Wave-payment review; the README says it is inactive until configured and does not provide private PDF downloads. The sampled backend files show API ownership and Supabase calls, but not the frontend wiring, so those connections are omitted or marked unverified.

Main entry points: [`model1.html`](https://github.com/macalouboubaa-lab/model_cv/blob/main/model1.html) (14 CV templates), [`lib/supabase-api.js`](https://github.com/macalouboubaa-lab/model_cv/blob/main/lib/supabase-api.js) (Supabase API helpers), [`index.html`](https://github.com/macalouboubaa-lab/model_cv/blob/main/index.html) (Template gallery), [`api/payments.js`](https://github.com/macalouboubaa-lab/model_cv/blob/main/api/payments.js) (Payment submission)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_editor["CV gallery and editing"]
  node_gallery["Template gallery<br/>[index.html]"]
  node_templates["14 CV templates<br/>[model1.html]"]
  node_gallery_assets["Gallery assets"]
  node_browser_storage[("Browser local storage")]
  node_print["Browser print dialog"]
end

subgraph group_accounts["Accounts and configuration"]
  node_auth_pages["Signup and login pages<br/>[signup.html]"]
  node_login_api["Legacy login handler<br/>[login.js]"]
  node_config_api["Public configuration API<br/>[config.js]"]
  node_supabase_auth["Supabase Auth"]
end

subgraph group_payments["Manual payments"]
  node_payment_page["Payment page<br/>[payment.html]"]
  node_wave["Wave checkout"]
  node_payment_api["Payment submission<br/>[payments.js]"]
  node_admin_page["Admin page<br/>[admin.html]"]
  node_admin_api["Payment review API<br/>[payments.js]"]
  node_entitlements_api["Entitlement lookup<br/>[entitlements.js]"]
end

subgraph group_backend["Server and data"]
  node_shared_api["Supabase API helpers<br/>[supabase-api.js]"]
  node_supabase[("Supabase data services")]
end

node_visitor(("CV user"))

node_visitor -->|"opens"| node_gallery
node_visitor -->|"opens or selects"| node_templates
node_gallery -->|"links to"| node_templates
node_gallery -->|"uses"| node_gallery_assets
node_visitor -->|"edits"| node_templates
node_templates -->|"saves and loads"| node_browser_storage
node_templates -->|"opens for PDF"| node_print
node_visitor -.->|"opens"| node_auth_pages
node_auth_pages -.->|"authenticates with"| node_supabase_auth
node_visitor -.->|"submits login"| node_login_api
node_config_api -->|"uses"| node_shared_api
node_payment_page -->|"links to"| node_wave
node_payment_page -.->|"submits payment"| node_payment_api
node_payment_api -->|"calls"| node_shared_api
node_admin_page -.->|"reviews payments"| node_admin_api
node_admin_api -->|"calls"| node_shared_api
node_entitlements_api -->|"calls"| node_shared_api
node_login_api -->|"queries users"| node_supabase
node_shared_api -->|"requests Auth and REST"| node_supabase
node_payment_api -->|"writes payment"| node_supabase
node_admin_api -->|"lists and reviews"| node_supabase
node_entitlements_api -->|"reads entitlement"| node_supabase

click node_gallery "https://github.com/macalouboubaa-lab/model_cv/blob/main/index.html"
click node_templates "https://github.com/macalouboubaa-lab/model_cv/blob/main/model1.html"
click node_gallery_assets "https://github.com/macalouboubaa-lab/model_cv/tree/main/assets"
click node_auth_pages "https://github.com/macalouboubaa-lab/model_cv/blob/main/signup.html"
click node_login_api "https://github.com/macalouboubaa-lab/model_cv/blob/main/api/login.js"
click node_config_api "https://github.com/macalouboubaa-lab/model_cv/blob/main/api/config.js"
click node_payment_page "https://github.com/macalouboubaa-lab/model_cv/blob/main/payment.html"
click node_payment_api "https://github.com/macalouboubaa-lab/model_cv/blob/main/api/payments.js"
click node_admin_page "https://github.com/macalouboubaa-lab/model_cv/blob/main/admin.html"
click node_admin_api "https://github.com/macalouboubaa-lab/model_cv/blob/main/api/admin/payments.js"
click node_entitlements_api "https://github.com/macalouboubaa-lab/model_cv/blob/main/api/entitlements.js"
click node_shared_api "https://github.com/macalouboubaa-lab/model_cv/blob/main/lib/supabase-api.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_gallery,node_templates,node_gallery_assets,node_browser_storage,node_print,node_visitor toneBlue
class node_auth_pages,node_login_api,node_config_api,node_supabase_auth toneAmber
class node_payment_page,node_wave,node_payment_api,node_admin_page,node_admin_api,node_entitlements_api toneMint
class node_shared_api,node_supabase toneRose
```

## Components

### CV gallery and editing

- [Template gallery](https://github.com/macalouboubaa-lab/model_cv/blob/main/index.html): `index.html`
- [14 CV templates](https://github.com/macalouboubaa-lab/model_cv/blob/main/model1.html): `model1.html`
- [Gallery assets](https://github.com/macalouboubaa-lab/model_cv/tree/main/assets): `assets`
- **Browser local storage**
- **Browser print dialog**

### Accounts and configuration

- [Signup and login pages](https://github.com/macalouboubaa-lab/model_cv/blob/main/signup.html): `signup.html`
- [Legacy login handler](https://github.com/macalouboubaa-lab/model_cv/blob/main/api/login.js): `api/login.js`
- [Public configuration API](https://github.com/macalouboubaa-lab/model_cv/blob/main/api/config.js): `api/config.js`
- **Supabase Auth**

### Manual payments

- [Payment page](https://github.com/macalouboubaa-lab/model_cv/blob/main/payment.html): `payment.html`
- **Wave checkout**
- [Payment submission](https://github.com/macalouboubaa-lab/model_cv/blob/main/api/payments.js): `api/payments.js`
- [Admin page](https://github.com/macalouboubaa-lab/model_cv/blob/main/admin.html): `admin.html`
- [Payment review API](https://github.com/macalouboubaa-lab/model_cv/blob/main/api/admin/payments.js): `api/admin/payments.js`
- [Entitlement lookup](https://github.com/macalouboubaa-lab/model_cv/blob/main/api/entitlements.js): `api/entitlements.js`

### Server and data

- [Supabase API helpers](https://github.com/macalouboubaa-lab/model_cv/blob/main/lib/supabase-api.js): `lib/supabase-api.js`
- **Supabase data services**

### Other components

- **CV user**

## Connections

- CV user → Template gallery: opens (evidence: `README.md`)
- CV user → 14 CV templates: opens or selects (evidence: `README.md`)
- Template gallery → 14 CV templates: links to (evidence: `README.md`)
- Template gallery → Gallery assets: uses (evidence: `README.md`)
- CV user → 14 CV templates: edits (evidence: `README.md`)
- 14 CV templates → Browser local storage: saves and loads (evidence: `README.md`)
- 14 CV templates → Browser print dialog: opens for PDF (evidence: `README.md`)
- CV user → Signup and login pages: opens
- Signup and login pages → Supabase Auth: authenticates with
- CV user → Legacy login handler: submits login
- Public configuration API → Supabase API helpers: uses (evidence: `api/config.js`)
- Payment page → Wave checkout: links to (evidence: `README.md`)
- Payment page → Payment submission: submits payment
- Payment submission → Supabase API helpers: calls (evidence: `api/payments.js`)
- Admin page → Payment review API: reviews payments
- Payment review API → Supabase API helpers: calls (evidence: `api/admin/payments.js`)
- Entitlement lookup → Supabase API helpers: calls (evidence: `api/entitlements.js`)
- Legacy login handler → Supabase data services: queries users (evidence: `api/login.js`)
- Supabase API helpers → Supabase data services: requests Auth and REST (evidence: `lib/supabase-api.js`)
- Payment submission → Supabase data services: writes payment (evidence: `api/payments.js`)
- Payment review API → Supabase data services: lists and reviews (evidence: `api/admin/payments.js`)
- Entitlement lookup → Supabase data services: reads entitlement (evidence: `api/entitlements.js`)
