# prodbyfarid/study-club-web-lab-booking architecture

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

- Interactive diagram: https://gitdiagram.com/prodbyfarid/study-club-web-lab-booking
- Repository: https://github.com/prodbyfarid/study-club-web-lab-booking

## Overview

This is a Next.js lab-room booking starter. Users sign up or log in, browse active rooms, submit a booking, and view or cancel their own bookings. Booking actions validate input and write through Supabase; the database enforces row-level access and rejects overlapping bookings. The graph preserves the documented session-proxy and database-security layers. SQL capabilities and some page wiring are documented or indexed rather than fully excerpted, so those relationships cite the README or are omitted where not established.

Main entry points: [`src/lib/supabase/server.ts`](https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/lib/supabase/server.ts) (Server Supabase client), [`src/lib/auth.ts`](https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/lib/auth.ts) (User and profile lookup), [`src/app/bookings/page.tsx`](https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/app/bookings/page.tsx) (My bookings page), [`src/app/bookings/new/page.tsx`](https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/app/bookings/new/page.tsx) (New booking page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_app_layout["App layout<br/>[layout.tsx]"]
  node_home["Home page<br/>[page.tsx]"]
  node_login_signup["Login and signup pages<br/>[page.tsx]"]
  node_auth_form["Auth form<br/>[AuthForm.tsx]"]
  node_navbar["Navigation<br/>[Navbar.tsx]"]
end

subgraph group_identity["Identity and sessions"]
  node_auth_actions["Auth actions<br/>[auth.ts]"]
  node_auth_helpers["User and profile lookup<br/>[auth.ts]"]
  node_request_proxy["Request proxy<br/>[proxy.ts]"]
  node_session_proxy["Session refresh and redirects<br/>[proxy.ts]"]
end

subgraph group_booking["Booking workflow"]
  node_rooms_page["Room listing<br/>[page.tsx]"]
  node_new_booking["New booking page<br/>[page.tsx]"]
  node_booking_form["Booking form<br/>[BookingForm.tsx]"]
  node_booking_actions["Booking actions<br/>[bookings.ts]"]
  node_my_bookings["My bookings page<br/>[page.tsx]"]
  node_status_badge["Status badge<br/>[StatusBadge.tsx]"]
end

subgraph group_data["Supabase data"]
  node_server_client["Server Supabase client<br/>[server.ts]"]
  node_browser_client["Browser Supabase client<br/>[client.ts]"]
  node_db_schema[("Schema, RLS, overlap constraint<br/>[01_schema.sql]")]
  node_db_seed["Initial room data<br/>[02_seed.sql]"]
end

node_visitor(("Visitor"))
node_supabase_auth["Supabase Auth"]
node_supabase_db[("Supabase Postgres")]

node_visitor -->|"opens app"| node_app_layout
node_app_layout -->|"renders"| node_navbar
node_visitor -->|"chooses auth"| node_login_signup
node_login_signup -->|"renders"| node_auth_form
node_auth_form -->|"submits to"| node_auth_actions
node_auth_actions -->|"creates client"| node_server_client
node_auth_actions -->|"signs in or up"| node_supabase_auth
node_navbar -->|"loads profile"| node_auth_helpers
node_navbar -->|"submits logout"| node_auth_actions
node_request_proxy -->|"delegates"| node_session_proxy
node_session_proxy -->|"refreshes session"| node_supabase_auth
node_visitor -->|"browses rooms"| node_rooms_page
node_rooms_page -->|"requires user"| node_auth_helpers
node_rooms_page -->|"creates client"| node_server_client
node_rooms_page -->|"reads active rooms"| node_supabase_db
node_visitor -->|"starts booking"| node_new_booking
node_new_booking -->|"requires user"| node_auth_helpers
node_new_booking -->|"creates client"| node_server_client
node_new_booking -->|"loads room choices"| node_supabase_db
node_new_booking -->|"renders"| node_booking_form
node_booking_form -->|"submits to"| node_booking_actions
node_booking_actions -->|"requires user"| node_auth_helpers
node_booking_actions -->|"creates client"| node_server_client
node_booking_actions -->|"inserts or updates"| node_supabase_db
node_supabase_db -->|"enforces RLS and overlap"| node_db_schema
node_visitor -->|"views bookings"| node_my_bookings
node_my_bookings -->|"requires user"| node_auth_helpers
node_my_bookings -->|"creates client"| node_server_client
node_my_bookings -->|"reads own bookings"| node_supabase_db
node_my_bookings -->|"submits cancellation"| node_booking_actions
node_my_bookings -->|"renders status"| node_status_badge
node_db_seed -->|"seeds room data"| node_supabase_db
node_auth_helpers -->|"creates client"| node_server_client
node_auth_helpers -->|"checks claims"| node_supabase_auth
node_server_client -->|"connects to"| node_supabase_db
node_server_client -->|"uses session cookies"| node_supabase_auth
node_browser_client -.->|"supports browser auth"| node_supabase_auth

click node_app_layout "https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/app/layout.tsx"
click node_home "https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/app/page.tsx"
click node_login_signup "https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/app/login/page.tsx"
click node_auth_form "https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/components/AuthForm.tsx"
click node_navbar "https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/components/Navbar.tsx"
click node_rooms_page "https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/app/rooms/page.tsx"
click node_new_booking "https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/app/bookings/new/page.tsx"
click node_booking_form "https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/components/BookingForm.tsx"
click node_booking_actions "https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/actions/bookings.ts"
click node_my_bookings "https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/app/bookings/page.tsx"
click node_status_badge "https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/components/StatusBadge.tsx"
click node_auth_actions "https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/actions/auth.ts"
click node_auth_helpers "https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/lib/auth.ts"
click node_request_proxy "https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/proxy.ts"
click node_session_proxy "https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/lib/supabase/proxy.ts"
click node_server_client "https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/lib/supabase/server.ts"
click node_browser_client "https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/lib/supabase/client.ts"
click node_db_schema "https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/supabase/01_schema.sql"
click node_db_seed "https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/supabase/02_seed.sql"

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_app_layout,node_home,node_login_signup,node_auth_form,node_navbar toneBlue
class node_auth_actions,node_auth_helpers,node_request_proxy,node_session_proxy,node_supabase_db toneAmber
class node_rooms_page,node_new_booking,node_booking_form,node_booking_actions,node_my_bookings,node_status_badge toneMint
class node_server_client,node_browser_client,node_db_schema,node_db_seed toneRose
class node_visitor,node_supabase_auth toneIndigo
```

## Components

### Web interface

- [App layout](https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/app/layout.tsx): `src/app/layout.tsx`
- [Home page](https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Login and signup pages](https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/app/login/page.tsx): `src/app/login/page.tsx`
- [Auth form](https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/components/AuthForm.tsx): `src/components/AuthForm.tsx`
- [Navigation](https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/components/Navbar.tsx): `src/components/Navbar.tsx`

### Identity and sessions

- [Auth actions](https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/actions/auth.ts): `src/actions/auth.ts`
- [User and profile lookup](https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [Request proxy](https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/proxy.ts): `src/proxy.ts`
- [Session refresh and redirects](https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/lib/supabase/proxy.ts): `src/lib/supabase/proxy.ts`

### Booking workflow

- [Room listing](https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/app/rooms/page.tsx): `src/app/rooms/page.tsx`
- [New booking page](https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/app/bookings/new/page.tsx): `src/app/bookings/new/page.tsx`
- [Booking form](https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/components/BookingForm.tsx): `src/components/BookingForm.tsx`
- [Booking actions](https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/actions/bookings.ts): `src/actions/bookings.ts`
- [My bookings page](https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/app/bookings/page.tsx): `src/app/bookings/page.tsx`
- [Status badge](https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/components/StatusBadge.tsx): `src/components/StatusBadge.tsx`

### Supabase data

- [Server Supabase client](https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/lib/supabase/server.ts): `src/lib/supabase/server.ts`
- [Browser Supabase client](https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/src/lib/supabase/client.ts): `src/lib/supabase/client.ts`
- [Schema, RLS, overlap constraint](https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/supabase/01_schema.sql): `supabase/01_schema.sql`
- [Initial room data](https://github.com/prodbyfarid/study-club-web-lab-booking/blob/main/supabase/02_seed.sql): `supabase/02_seed.sql`

### Other components

- **Visitor**
- **Supabase Auth**
- **Supabase Postgres**

## Connections

- Visitor → App layout: opens app (evidence: `src/app/layout.tsx`)
- App layout → Navigation: renders (evidence: `src/app/layout.tsx`)
- Visitor → Login and signup pages: chooses auth (evidence: `README.md`)
- Login and signup pages → Auth form: renders (evidence: `README.md`)
- Auth form → Auth actions: submits to (evidence: `src/components/AuthForm.tsx`)
- Auth actions → Server Supabase client: creates client (evidence: `src/actions/auth.ts`)
- Auth actions → Supabase Auth: signs in or up (evidence: `src/actions/auth.ts`)
- Navigation → User and profile lookup: loads profile (evidence: `src/components/Navbar.tsx`)
- Navigation → Auth actions: submits logout (evidence: `src/components/Navbar.tsx`)
- Request proxy → Session refresh and redirects: delegates (evidence: `src/proxy.ts`)
- Session refresh and redirects → Supabase Auth: refreshes session (evidence: `README.md`)
- Visitor → Room listing: browses rooms (evidence: `README.md`)
- Room listing → User and profile lookup: requires user (evidence: `src/app/rooms/page.tsx`)
- Room listing → Server Supabase client: creates client (evidence: `src/app/rooms/page.tsx`)
- Room listing → Supabase Postgres: reads active rooms (evidence: `src/app/rooms/page.tsx`)
- Visitor → New booking page: starts booking (evidence: `README.md`)
- New booking page → User and profile lookup: requires user (evidence: `src/app/bookings/new/page.tsx`)
- New booking page → Server Supabase client: creates client (evidence: `src/app/bookings/new/page.tsx`)
- New booking page → Supabase Postgres: loads room choices (evidence: `src/app/bookings/new/page.tsx`)
- New booking page → Booking form: renders (evidence: `src/app/bookings/new/page.tsx`)
- Booking form → Booking actions: submits to (evidence: `src/components/BookingForm.tsx`)
- Booking actions → User and profile lookup: requires user (evidence: `src/actions/bookings.ts`)
- Booking actions → Server Supabase client: creates client (evidence: `src/actions/bookings.ts`)
- Booking actions → Supabase Postgres: inserts or updates (evidence: `src/actions/bookings.ts`)
- Supabase Postgres → Schema, RLS, overlap constraint: enforces RLS and overlap (evidence: `README.md`)
- Visitor → My bookings page: views bookings (evidence: `README.md`)
- My bookings page → User and profile lookup: requires user (evidence: `src/app/bookings/page.tsx`)
- My bookings page → Server Supabase client: creates client (evidence: `src/app/bookings/page.tsx`)
- My bookings page → Supabase Postgres: reads own bookings (evidence: `src/app/bookings/page.tsx`)
- My bookings page → Booking actions: submits cancellation (evidence: `src/app/bookings/page.tsx`)
- My bookings page → Status badge: renders status (evidence: `src/app/bookings/page.tsx`)
- Initial room data → Supabase Postgres: seeds room data (evidence: `README.md`)
- User and profile lookup → Server Supabase client: creates client (evidence: `src/lib/auth.ts`)
- User and profile lookup → Supabase Auth: checks claims (evidence: `README.md`)
- Server Supabase client → Supabase Postgres: connects to (evidence: `src/lib/supabase/server.ts`)
- Server Supabase client → Supabase Auth: uses session cookies (evidence: `README.md`)
- Browser Supabase client → Supabase Auth: supports browser auth
