# jaroenwitsorose/guan-badminton architecture

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

- Interactive diagram: https://gitdiagram.com/jaroenwitsorose/guan-badminton
- Repository: https://github.com/jaroenwitsorose/guan-badminton

## Overview

This is a badminton-group operations web app: players check the live court board, register ahead, review results, pay balances, and contact organizers; staff check players in, arrange and score games, manage days and members, and reconcile payments. The graph preserves the documented demo, photo, audit, export, and standings capabilities. Several subsystems are represented from README descriptions and the source index rather than inspected implementations, so their links cite the README and uncertain internal wiring is omitted.

Main entry points: [`src/actions/board.ts`](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/actions/board.ts) (Game and check-in actions), [`src/lib/prisma.ts`](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/lib/prisma.ts) (Application database), [`src/app/(public)/page.tsx`](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/app/(public)/page.tsx) (Public pages), [`src/app/staff/(panel)/staff-board.tsx`](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/app/staff/(panel)/staff-board.tsx) (Staff court board)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_player["Player experience"]
  node_public_site["Public pages<br/>[page.tsx]"]
  node_live_board["Live board<br/>[board-view.tsx]"]
  node_registration["Advance registration"]
  node_history["Game history<br/>[page.tsx]"]
  node_members_public["Member standings<br/>[page.tsx]"]
  node_message["Organizer messages<br/>[page.tsx]"]
  node_payment_public["Player payments<br/>[page.tsx]"]
end

subgraph group_court["Court operations"]
  node_staff_board["Staff court board<br/>[staff-board.tsx]"]
  node_board_actions["Game and check-in actions<br/>[board.ts]"]
  node_matchmaker["Matchmaking<br/>[matchmaker.ts]"]
  node_scoring["Game scoring<br/>[scoring.ts]"]
  node_days["Play-day management<br/>[days-manager.tsx]"]
end

subgraph group_finance["Members and finance"]
  node_registrations["Registration actions<br/>[registration.ts]"]
  node_management["Staff management actions<br/>[manage.ts]"]
  node_billing["Billing rules<br/>[billing.ts]"]
  node_payment_api["Payment reporting API<br/>[route.ts]"]
  node_photo_api["Player photo APIs<br/>[route.ts]"]
end

subgraph group_core["Application services"]
  node_demo["Demo mode<br/>[demo-flag.ts]"]
  node_data["Queries and statistics<br/>[data.ts]"]
  node_auth["Authentication and roles<br/>[auth.ts]"]
  node_audit["Action audit<br/>[audit.ts]"]
  node_database[("Application database<br/>[prisma.ts]")]
  node_file_storage[("Photo and slip storage<br/>[storage.ts]")]
end

node_players(("Players"))
node_staff(("Staff"))
node_organizer(("Organizer"))
node_blob[("Vercel Blob")]

node_players -->|"browse"| node_public_site
node_public_site -->|"shows board"| node_live_board
node_players -->|"register ahead"| node_registration
node_registration -->|"submits registration"| node_registrations
node_players -->|"review games"| node_history
node_players -->|"view standings"| node_members_public
node_players -->|"contact"| node_message
node_players -->|"pay balance"| node_payment_public
node_payment_public -->|"reports transfer"| node_payment_api
node_staff -->|"manage games"| node_staff_board
node_staff_board -->|"dispatches actions"| node_board_actions
node_staff_board -->|"requests pairings"| node_matchmaker
node_board_actions -->|"uses pairing logic"| node_matchmaker
node_board_actions -->|"validates scores"| node_scoring
node_staff -->|"manage play days"| node_days
node_days -->|"calls day actions"| node_management
node_management -->|"updates records"| node_database
node_board_actions -->|"reads and writes"| node_database
node_registrations -.->|"stores registrations"| node_database
node_payment_api -->|"computes balances"| node_billing
node_payment_api -->|"saves slips"| node_file_storage
node_file_storage -->|"stores online files"| node_blob
node_staff -->|"manage members"| node_management
node_management -->|"deletes photos"| node_file_storage
node_players -->|"change own photo"| node_photo_api
node_photo_api -->|"replaces photo"| node_file_storage
node_public_site -->|"loads board data"| node_data
node_data -.->|"queries records"| node_database
node_staff -->|"sign in"| node_auth
node_auth -->|"checks credentials"| node_database
node_board_actions -->|"requires actor"| node_auth
node_board_actions -->|"records actions"| node_audit
node_organizer -->|"organize games"| node_staff_board
node_staff -->|"enable demo"| node_demo
node_demo -.->|"serves sample view"| node_public_site

click node_public_site "https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/app/(public)/page.tsx"
click node_live_board "https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/components/board-view.tsx"
click node_registration "https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/app/(public)/register/register-client.tsx"
click node_history "https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/app/(public)/history/page.tsx"
click node_members_public "https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/app/(public)/members/page.tsx"
click node_message "https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/app/(public)/message/page.tsx"
click node_payment_public "https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/app/(public)/pay/%5Bid%5D/page.tsx"
click node_staff_board "https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/app/staff/(panel)/staff-board.tsx"
click node_board_actions "https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/actions/board.ts"
click node_matchmaker "https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/lib/matchmaker.ts"
click node_scoring "https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/lib/scoring.ts"
click node_days "https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/app/staff/(panel)/days/days-manager.tsx"
click node_registrations "https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/actions/registration.ts"
click node_management "https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/actions/manage.ts"
click node_billing "https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/lib/billing.ts"
click node_payment_api "https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/app/api/pay/%5BattendanceId%5D/route.ts"
click node_photo_api "https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/app/api/me/photo/route.ts"
click node_demo "https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/lib/demo-flag.ts"
click node_data "https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/lib/data.ts"
click node_auth "https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/lib/auth.ts"
click node_audit "https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/lib/audit.ts"
click node_database "https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/lib/prisma.ts"
click node_file_storage "https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/lib/storage.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_public_site,node_live_board,node_registration,node_history,node_members_public,node_message,node_payment_public toneBlue
class node_staff_board,node_board_actions,node_matchmaker,node_scoring,node_days,node_blob toneAmber
class node_registrations,node_management,node_billing,node_payment_api,node_photo_api toneMint
class node_demo,node_data,node_auth,node_audit,node_database,node_file_storage toneRose
class node_players,node_staff,node_organizer toneIndigo
```

## Components

### Player experience

- [Public pages](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/app/(public)/page.tsx): `src/app/(public)/page.tsx`
- [Live board](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/components/board-view.tsx): `src/components/board-view.tsx`
- [Advance registration](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/app/(public)/register/register-client.tsx): `src/app/(public)/register/register-client.tsx`
- [Game history](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/app/(public)/history/page.tsx): `src/app/(public)/history/page.tsx`
- [Member standings](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/app/(public)/members/page.tsx): `src/app/(public)/members/page.tsx`
- [Organizer messages](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/app/(public)/message/page.tsx): `src/app/(public)/message/page.tsx`
- [Player payments](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/app/(public)/pay/%5Bid%5D/page.tsx): `src/app/(public)/pay/[id]/page.tsx`

### Court operations

- [Staff court board](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/app/staff/(panel)/staff-board.tsx): `src/app/staff/(panel)/staff-board.tsx`
- [Game and check-in actions](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/actions/board.ts): `src/actions/board.ts`
- [Matchmaking](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/lib/matchmaker.ts): `src/lib/matchmaker.ts`
- [Game scoring](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/lib/scoring.ts): `src/lib/scoring.ts`
- [Play-day management](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/app/staff/(panel)/days/days-manager.tsx): `src/app/staff/(panel)/days/days-manager.tsx`

### Members and finance

- [Registration actions](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/actions/registration.ts): `src/actions/registration.ts`
- [Staff management actions](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/actions/manage.ts): `src/actions/manage.ts`
- [Billing rules](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/lib/billing.ts): `src/lib/billing.ts`
- [Payment reporting API](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/app/api/pay/%5BattendanceId%5D/route.ts): `src/app/api/pay/[attendanceId]/route.ts`
- [Player photo APIs](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/app/api/me/photo/route.ts): `src/app/api/me/photo/route.ts`

### Application services

- [Demo mode](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/lib/demo-flag.ts): `src/lib/demo-flag.ts`
- [Queries and statistics](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/lib/data.ts): `src/lib/data.ts`
- [Authentication and roles](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [Action audit](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/lib/audit.ts): `src/lib/audit.ts`
- [Application database](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/lib/prisma.ts): `src/lib/prisma.ts`
- [Photo and slip storage](https://github.com/jaroenwitsorose/guan-badminton/blob/main/src/lib/storage.ts): `src/lib/storage.ts`

### Other components

- **Players**
- **Staff**
- **Organizer**
- **Vercel Blob**

## Connections

- Players → Public pages: browse (evidence: `README.md`)
- Public pages → Live board: shows board (evidence: `README.md`)
- Players → Advance registration: register ahead (evidence: `README.md`)
- Advance registration → Registration actions: submits registration (evidence: `src/app/(public)/register/register-client.tsx`)
- Players → Game history: review games (evidence: `README.md`)
- Players → Member standings: view standings (evidence: `README.md`)
- Players → Organizer messages: contact (evidence: `README.md`)
- Players → Player payments: pay balance (evidence: `README.md`)
- Player payments → Payment reporting API: reports transfer (evidence: `README.md`)
- Staff → Staff court board: manage games (evidence: `README.md`)
- Staff court board → Game and check-in actions: dispatches actions (evidence: `README.md`)
- Staff court board → Matchmaking: requests pairings (evidence: `README.md`)
- Game and check-in actions → Matchmaking: uses pairing logic (evidence: `src/actions/board.ts`)
- Game and check-in actions → Game scoring: validates scores (evidence: `src/actions/board.ts`)
- Staff → Play-day management: manage play days (evidence: `README.md`)
- Play-day management → Staff management actions: calls day actions (evidence: `src/app/staff/(panel)/days/days-manager.tsx`)
- Staff management actions → Application database: updates records (evidence: `src/actions/manage.ts`)
- Game and check-in actions → Application database: reads and writes (evidence: `src/actions/board.ts`)
- Registration actions → Application database: stores registrations
- Payment reporting API → Billing rules: computes balances (evidence: `src/app/api/pay/[attendanceId]/route.ts`)
- Payment reporting API → Photo and slip storage: saves slips (evidence: `src/app/api/pay/[attendanceId]/route.ts`)
- Photo and slip storage → Vercel Blob: stores online files (evidence: `src/lib/storage.ts`)
- Staff → Staff management actions: manage members (evidence: `README.md`)
- Staff management actions → Photo and slip storage: deletes photos (evidence: `src/actions/manage.ts`)
- Players → Player photo APIs: change own photo (evidence: `README.md`)
- Player photo APIs → Photo and slip storage: replaces photo (evidence: `src/app/api/me/photo/route.ts`)
- Public pages → Queries and statistics: loads board data
- Queries and statistics → Application database: queries records
- Staff → Authentication and roles: sign in (evidence: `README.md`)
- Authentication and roles → Application database: checks credentials (evidence: `src/actions/auth.ts`)
- Game and check-in actions → Authentication and roles: requires actor (evidence: `src/actions/board.ts`)
- Game and check-in actions → Action audit: records actions (evidence: `src/actions/board.ts`)
- Organizer → Staff court board: organize games (evidence: `README.md`)
- Staff → Demo mode: enable demo (evidence: `README.md`)
- Demo mode → Public pages: serves sample view
