# mr-black-droid/class-booking architecture

> Architecture diagram of the GitHub repository mr-black-droid/class-booking, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mr-black-droid/class-booking
- Repository: https://github.com/mr-black-droid/class-booking

## Overview

Class slot booking is a browser-based weekly timetable backed by Supabase. Staff sign in with Google and approved emails can view and book slots; overlapping requests enter an ordered waitlist, while admins manage bookings and staff. Cancellation promotes the next waiter, and database outbox events drive email alerts through Resend. The README and sampled code establish the browser-to-Supabase and notification paths; the migration's internal rules and UI implementation were not excerpted, so those connections are documented rather than asserted as inspected source calls.

Main entry points: [`web/index.html`](https://github.com/mr-black-droid/class-booking/blob/main/web/index.html) (Booking page), [`supabase/functions/notify/index.ts`](https://github.com/mr-black-droid/class-booking/blob/main/supabase/functions/notify/index.ts) (Notification sender), [`supabase/migrations/0001_init.sql`](https://github.com/mr-black-droid/class-booking/blob/main/supabase/migrations/0001_init.sql) (Email outbox), [`web/config.js`](https://github.com/mr-black-droid/class-booking/blob/main/web/config.js) (Page configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_booking["Booking experience"]
  node_page["Booking page<br/>[index.html]"]
  node_page_config["Page configuration<br/>[config.js]"]
end

subgraph group_supabase["Supabase services"]
  node_auth["Google sign-in"]
  node_booking_db[("Booking and waitlist rules<br/>[0001_init.sql]")]
  node_access[("Access and admin rules<br/>[0001_init.sql]")]
  node_session_log[("Session log and attendance<br/>[0001_init.sql]")]
  node_outbox[("Email outbox<br/>[0001_init.sql]")]
end

subgraph group_alerts["Email alerts"]
  node_notify["Notification sender<br/>[index.ts]"]
  node_resend["Resend"]
end

node_staff(("Staff"))
node_admins(("Admins"))

node_staff -->|"uses"| node_page
node_admins -->|"manages"| node_page
node_page -->|"reads settings"| node_page_config
node_page -->|"signs in"| node_auth
node_page -->|"checks access"| node_access
node_page -->|"books and updates"| node_booking_db
node_admins -->|"reviews"| node_session_log
node_booking_db -->|"queues email"| node_outbox
node_outbox -->|"webhook triggers"| node_notify
node_notify -->|"reads and updates"| node_outbox
node_notify -->|"sends email"| node_resend

click node_page "https://github.com/mr-black-droid/class-booking/blob/main/web/index.html"
click node_page_config "https://github.com/mr-black-droid/class-booking/blob/main/web/config.js"
click node_booking_db "https://github.com/mr-black-droid/class-booking/blob/main/supabase/migrations/0001_init.sql"
click node_access "https://github.com/mr-black-droid/class-booking/blob/main/supabase/migrations/0001_init.sql"
click node_session_log "https://github.com/mr-black-droid/class-booking/blob/main/supabase/migrations/0001_init.sql"
click node_outbox "https://github.com/mr-black-droid/class-booking/blob/main/supabase/migrations/0001_init.sql"
click node_notify "https://github.com/mr-black-droid/class-booking/blob/main/supabase/functions/notify/index.ts"

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_page,node_page_config toneBlue
class node_auth,node_booking_db,node_access,node_session_log,node_outbox toneAmber
class node_notify,node_resend toneMint
class node_staff,node_admins toneIndigo
```

## Components

### Booking experience

- [Booking page](https://github.com/mr-black-droid/class-booking/blob/main/web/index.html): `web/index.html`
- [Page configuration](https://github.com/mr-black-droid/class-booking/blob/main/web/config.js): `web/config.js`

### Supabase services

- **Google sign-in**
- [Booking and waitlist rules](https://github.com/mr-black-droid/class-booking/blob/main/supabase/migrations/0001_init.sql): `supabase/migrations/0001_init.sql`
- [Access and admin rules](https://github.com/mr-black-droid/class-booking/blob/main/supabase/migrations/0001_init.sql): `supabase/migrations/0001_init.sql`
- [Session log and attendance](https://github.com/mr-black-droid/class-booking/blob/main/supabase/migrations/0001_init.sql): `supabase/migrations/0001_init.sql`
- [Email outbox](https://github.com/mr-black-droid/class-booking/blob/main/supabase/migrations/0001_init.sql): `supabase/migrations/0001_init.sql`

### Email alerts

- [Notification sender](https://github.com/mr-black-droid/class-booking/blob/main/supabase/functions/notify/index.ts): `supabase/functions/notify/index.ts`
- **Resend**

### Other components

- **Staff**
- **Admins**

## Connections

- Staff → Booking page: uses (evidence: `README.md`)
- Admins → Booking page: manages (evidence: `README.md`)
- Booking page → Page configuration: reads settings (evidence: `README.md`)
- Booking page → Google sign-in: signs in (evidence: `README.md`)
- Booking page → Access and admin rules: checks access (evidence: `README.md`)
- Booking page → Booking and waitlist rules: books and updates (evidence: `README.md`)
- Admins → Session log and attendance: reviews (evidence: `README.md`)
- Booking and waitlist rules → Email outbox: queues email (evidence: `README.md`)
- Email outbox → Notification sender: webhook triggers (evidence: `supabase/functions/notify/index.ts`)
- Notification sender → Email outbox: reads and updates (evidence: `supabase/functions/notify/index.ts`)
- Notification sender → Resend: sends email (evidence: `supabase/functions/notify/index.ts`)
