# toramiyuu/tzh-sports-centre architecture

> Architecture diagram of the GitHub repository toramiyuu/tzh-sports-centre, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/toramiyuu/tzh-sports-centre
- Repository: https://github.com/toramiyuu/tzh-sports-centre

## Overview

This is a badminton and pickleball club portal combining court bookings, lessons, member self-service, and staff operations with shop, racket-stringing, and video-subscription features. The main customer flow is checking court availability, booking a slot, and viewing the resulting booking or receipt; members also manage lessons and absences, while staff administer schedules and billing. The graph follows the route and page structure in the tree. Sampled handlers confirm booking, availability, absence, and billing interactions with Prisma; other feature links reflect the available routes, not inspected call sites.

Main entry points: [`app/admin/page.tsx`](https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/admin/page.tsx) (Admin workspace), [`lib/prisma.ts`](https://github.com/toramiyuu/tzh-sports-centre/blob/main/lib/prisma.ts) (Application database), [`app/api/bookings/route.ts`](https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/bookings/route.ts) (Court bookings), [`lib/auth.ts`](https://github.com/toramiyuu/tzh-sports-centre/blob/main/lib/auth.ts) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_booking_ui["Court booking<br/>[page.tsx]"]
  node_member_ui["Member dashboard<br/>[page.tsx]"]
  node_profile_ui["Profile and billing<br/>[page.tsx]"]
  node_admin_ui["Admin workspace<br/>[page.tsx]"]
  node_teacher_ui["Teacher dashboard<br/>[page.tsx]"]
  node_leaderboard["Leaderboard<br/>[route.ts]"]
end

subgraph group_scheduling["Bookings and lessons"]
  node_availability["Court availability<br/>[route.ts]"]
  node_bookings["Court bookings<br/>[route.ts]"]
  node_recurring["Recurring bookings<br/>[route.ts]"]
  node_lessons["Lesson scheduling<br/>[route.ts]"]
  node_weekly["Weekly availability<br/>[route.ts]"]
end

subgraph group_operations["Club operations"]
  node_absences["Absence requests<br/>[route.ts]"]
  node_billing["Monthly billing<br/>[route.ts]"]
  node_accounts["Account administration<br/>[route.ts]"]
end

subgraph group_commerce["Commerce and media"]
  node_shop["Shop orders<br/>[route.ts]"]
  node_stringing["Racket stringing<br/>[route.ts]"]
  node_videos["Video subscriptions<br/>[route.ts]"]
end

subgraph group_platform["Shared platform"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_validation["Validation and booking rules<br/>[validation.ts]"]
  node_db[("Application database<br/>[prisma.ts]")]
end

node_visitor(("Visitor or member"))
node_staff(("Club staff"))

node_visitor -->|"opens"| node_booking_ui
node_visitor -->|"uses"| node_member_ui
node_visitor -->|"manages account"| node_profile_ui
node_staff -->|"administers"| node_admin_ui
node_staff -->|"teaches"| node_teacher_ui
node_booking_ui -->|"checks slots"| node_availability
node_booking_ui -->|"submits booking"| node_bookings
node_availability -->|"reads schedules"| node_db
node_bookings -->|"checks session"| node_auth
node_bookings -->|"validates input"| node_validation
node_bookings -->|"checks and creates bookings"| node_db
node_member_ui -->|"requests timetable"| node_weekly
node_member_ui -->|"manages absences"| node_absences
node_profile_ui -->|"views billing"| node_billing
node_admin_ui -->|"manages bookings"| node_bookings
node_admin_ui -->|"manages recurrence"| node_recurring
node_admin_ui -->|"manages lessons"| node_lessons
node_admin_ui -->|"administers payments"| node_billing
node_admin_ui -->|"manages accounts"| node_accounts
node_teacher_ui -->|"views lessons"| node_lessons
node_weekly -->|"checks session"| node_auth
node_weekly -->|"reads schedules"| node_db
node_absences -->|"checks session"| node_auth
node_absences -->|"reads and writes absences"| node_db
node_billing -->|"checks session"| node_auth
node_billing -->|"reads billing data"| node_db
node_accounts -->|"checks session"| node_auth
node_accounts -->|"manages accounts"| node_db
node_visitor -->|"shops"| node_shop
node_visitor -->|"orders stringing"| node_stringing
node_visitor -->|"subscribes"| node_videos
node_visitor -->|"views standings"| node_leaderboard

click node_booking_ui "https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/booking/page.tsx"
click node_member_ui "https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/member/page.tsx"
click node_profile_ui "https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/profile/page.tsx"
click node_admin_ui "https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/admin/page.tsx"
click node_teacher_ui "https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/teacher/page.tsx"
click node_availability "https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/availability/route.ts"
click node_bookings "https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/bookings/route.ts"
click node_recurring "https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/recurring-bookings/route.ts"
click node_lessons "https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/admin/lessons/route.ts"
click node_weekly "https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/member/weekly-availability/route.ts"
click node_absences "https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/absences/route.ts"
click node_billing "https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/admin/monthly-payments/route.ts"
click node_accounts "https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/admin/accounts/route.ts"
click node_shop "https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/shop/orders/route.ts"
click node_stringing "https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/stringing/route.ts"
click node_videos "https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/videos/subscription/route.ts"
click node_leaderboard "https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/leaderboard/route.ts"
click node_auth "https://github.com/toramiyuu/tzh-sports-centre/blob/main/lib/auth.ts"
click node_validation "https://github.com/toramiyuu/tzh-sports-centre/blob/main/lib/validation.ts"
click node_db "https://github.com/toramiyuu/tzh-sports-centre/blob/main/lib/prisma.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_booking_ui,node_member_ui,node_profile_ui,node_admin_ui,node_teacher_ui,node_leaderboard toneBlue
class node_availability,node_bookings,node_recurring,node_lessons,node_weekly toneAmber
class node_absences,node_billing,node_accounts toneMint
class node_shop,node_stringing,node_videos toneRose
class node_auth,node_validation,node_db,node_visitor,node_staff toneIndigo
```

## Components

### User experience

- [Court booking](https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/booking/page.tsx): `app/booking/page.tsx`
- [Member dashboard](https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/member/page.tsx): `app/member/page.tsx`
- [Profile and billing](https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/profile/page.tsx): `app/profile/page.tsx`
- [Admin workspace](https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/admin/page.tsx): `app/admin/page.tsx`
- [Teacher dashboard](https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/teacher/page.tsx): `app/teacher/page.tsx`
- [Leaderboard](https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/leaderboard/route.ts): `app/api/leaderboard/route.ts`

### Bookings and lessons

- [Court availability](https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/availability/route.ts): `app/api/availability/route.ts`
- [Court bookings](https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/bookings/route.ts): `app/api/bookings/route.ts`
- [Recurring bookings](https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/recurring-bookings/route.ts): `app/api/recurring-bookings/route.ts`
- [Lesson scheduling](https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/admin/lessons/route.ts): `app/api/admin/lessons/route.ts`
- [Weekly availability](https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/member/weekly-availability/route.ts): `app/api/member/weekly-availability/route.ts`

### Club operations

- [Absence requests](https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/absences/route.ts): `app/api/absences/route.ts`
- [Monthly billing](https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/admin/monthly-payments/route.ts): `app/api/admin/monthly-payments/route.ts`
- [Account administration](https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/admin/accounts/route.ts): `app/api/admin/accounts/route.ts`

### Commerce and media

- [Shop orders](https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/shop/orders/route.ts): `app/api/shop/orders/route.ts`
- [Racket stringing](https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/stringing/route.ts): `app/api/stringing/route.ts`
- [Video subscriptions](https://github.com/toramiyuu/tzh-sports-centre/blob/main/app/api/videos/subscription/route.ts): `app/api/videos/subscription/route.ts`

### Shared platform

- [Authentication](https://github.com/toramiyuu/tzh-sports-centre/blob/main/lib/auth.ts): `lib/auth.ts`
- [Validation and booking rules](https://github.com/toramiyuu/tzh-sports-centre/blob/main/lib/validation.ts): `lib/validation.ts`
- [Application database](https://github.com/toramiyuu/tzh-sports-centre/blob/main/lib/prisma.ts): `lib/prisma.ts`

### Other components

- **Visitor or member**
- **Club staff**

## Connections

- Visitor or member → Court booking: opens
- Visitor or member → Member dashboard: uses
- Visitor or member → Profile and billing: manages account
- Club staff → Admin workspace: administers
- Club staff → Teacher dashboard: teaches
- Court booking → Court availability: checks slots
- Court booking → Court bookings: submits booking
- Court availability → Application database: reads schedules
- Court bookings → Authentication: checks session
- Court bookings → Validation and booking rules: validates input
- Court bookings → Application database: checks and creates bookings
- Member dashboard → Weekly availability: requests timetable
- Member dashboard → Absence requests: manages absences
- Profile and billing → Monthly billing: views billing
- Admin workspace → Court bookings: manages bookings
- Admin workspace → Recurring bookings: manages recurrence
- Admin workspace → Lesson scheduling: manages lessons
- Admin workspace → Monthly billing: administers payments
- Admin workspace → Account administration: manages accounts
- Teacher dashboard → Lesson scheduling: views lessons
- Weekly availability → Authentication: checks session
- Weekly availability → Application database: reads schedules
- Absence requests → Authentication: checks session
- Absence requests → Application database: reads and writes absences
- Monthly billing → Authentication: checks session
- Monthly billing → Application database: reads billing data
- Account administration → Authentication: checks session
- Account administration → Application database: manages accounts
- Visitor or member → Shop orders: shops
- Visitor or member → Racket stringing: orders stringing
- Visitor or member → Video subscriptions: subscribes
- Visitor or member → Leaderboard: views standings
