# massdann/project-bnsp architecture

> Architecture diagram of the GitHub repository massdann/project-bnsp, 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/massdann/project-bnsp
- Repository: https://github.com/massdann/project-bnsp

## Overview

SM Sport Center is a court-reservation and transaction-management application. Customers register or sign in, choose a court and time, reserve a slot, pay, and track their booking; administrators manage courts, verify transactions, and review reports. The diagram includes the sampled reservation, payment, authentication, and reporting paths, plus documented-by-tree admin and profile components. Several route and action implementations were not excerpted, so some plausible connections are omitted rather than inferred.

Main entry points: [`src/lib/db.ts`](https://github.com/massdann/project-bnsp/blob/main/src/lib/db.ts) (Postgres database), [`src/components/booking/JadwalLapangan.tsx`](https://github.com/massdann/project-bnsp/blob/main/src/components/booking/JadwalLapangan.tsx) (Schedule and booking UI), [`src/app/profil/ProfilClient.tsx`](https://github.com/massdann/project-bnsp/blob/main/src/app/profil/ProfilClient.tsx) (Profile and invoice UI), [`src/actions/reservasi.ts`](https://github.com/massdann/project-bnsp/blob/main/src/actions/reservasi.ts) (Reservation actions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_booking["Reservations"]
  node_home["Court discovery<br/>[page.tsx]"]
  node_court_list["Court schedule<br/>[page.tsx]"]
  node_court_detail["Court booking page<br/>[page.tsx]"]
  node_schedule["Schedule and booking UI<br/>[JadwalLapangan.tsx]"]
  node_reservation_actions["Reservation actions<br/>[reservasi.ts]"]
  node_profile_page["Booking profile page<br/>[page.tsx]"]
  node_profile_ui["Profile and invoice UI<br/>[ProfilClient.tsx]"]
  node_countdown["Payment countdown<br/>[CountdownTimer.tsx]"]
end

subgraph group_identity["Identity"]
  node_login_page["Login page<br/>[page.tsx]"]
  node_register_page["Registration page<br/>[page.tsx]"]
  node_auth_actions["Authentication actions<br/>[auth.ts]"]
  node_auth["Credentials and sessions<br/>[auth.ts]"]
  node_auth_route["Auth API route<br/>[route.ts]"]
end

subgraph group_operations["Administration"]
  node_court_admin["Court management<br/>[page.tsx]"]
  node_court_editor["Court editor"]
  node_court_actions["Court actions<br/>[adminLapangan.ts]"]
  node_verification["Payment verification<br/>[page.tsx]"]
  node_verification_actions["Verification actions<br/>[adminVerifikasi.ts]"]
  node_reports_page["Transaction report page<br/>[page.tsx]"]
  node_reports_ui["Report and export UI<br/>[LaporanClient.tsx]"]
  node_admin_dashboard["Admin dashboard<br/>[page.tsx]"]
  node_transaction_actions["Transaction actions<br/>[transaksi.ts]"]
  node_checkout["Payment checkout<br/>[route.ts]"]
  node_expiration["Reservation expiration<br/>[route.ts]"]
end

subgraph group_platform["Data and realtime"]
  node_database[("Postgres database<br/>[db.ts]")]
  node_schema["Domain tables<br/>[schema.ts]"]
  node_pusher_server["Realtime publisher<br/>[pusher.ts]"]
  node_pusher_client["Realtime client<br/>[pusher-client.ts]"]
end

node_customer(("Customer"))
node_admin_user(("Administrator"))
node_pusher_service(("Pusher service"))

node_customer -->|"opens"| node_login_page
node_customer -->|"registers"| node_register_page
node_login_page -->|"submits credentials"| node_auth_actions
node_register_page -->|"submits registration"| node_auth_actions
node_auth_actions -->|"signs in"| node_auth
node_auth -->|"checks accounts"| node_database
node_auth_route -->|"uses handlers"| node_auth
node_customer -.->|"browses"| node_home
node_home -->|"reads courts"| node_database
node_court_list -->|"reads courts"| node_database
node_court_detail -->|"renders"| node_schedule
node_schedule -->|"requests slot actions"| node_reservation_actions
node_reservation_actions -->|"reads and writes"| node_database
node_schedule -->|"renders"| node_countdown
node_schedule -->|"subscribes"| node_pusher_client
node_profile_page -->|"renders"| node_profile_ui
node_profile_ui -->|"cancels booking"| node_transaction_actions
node_profile_ui -->|"subscribes"| node_pusher_client
node_profile_ui -.->|"links to payment"| node_checkout
node_admin_user -.->|"manages courts"| node_court_admin
node_court_admin -->|"renders"| node_court_editor
node_court_editor -->|"submits changes"| node_court_actions
node_court_admin -->|"uses actions"| node_court_actions
node_court_actions -->|"reads and writes"| node_database
node_admin_user -.->|"reviews payments"| node_verification
node_verification -.->|"uses actions"| node_verification_actions
node_verification_actions -->|"reads and writes"| node_database
node_reports_page -->|"renders"| node_reports_ui
node_reports_page -->|"reads transactions"| node_database
node_admin_user -.->|"reviews reports"| node_reports_page
node_admin_dashboard -->|"reads summary data"| node_database
node_transaction_actions -->|"reads and writes"| node_database
node_checkout -->|"reads and updates"| node_database
node_checkout -->|"publishes payment"| node_pusher_server
node_expiration -->|"expires records"| node_database
node_reservation_actions -->|"publishes slot events"| node_pusher_server
node_pusher_server -.->|"sends events"| node_pusher_service
node_pusher_client -.->|"receives events"| node_pusher_service
node_database -->|"uses schema"| node_schema

click node_home "https://github.com/massdann/project-bnsp/blob/main/src/app/page.tsx"
click node_court_list "https://github.com/massdann/project-bnsp/blob/main/src/app/reservasi/page.tsx"
click node_court_detail "https://github.com/massdann/project-bnsp/blob/main/src/app/reservasi/%5Bid%5D/page.tsx"
click node_schedule "https://github.com/massdann/project-bnsp/blob/main/src/components/booking/JadwalLapangan.tsx"
click node_reservation_actions "https://github.com/massdann/project-bnsp/blob/main/src/actions/reservasi.ts"
click node_profile_page "https://github.com/massdann/project-bnsp/blob/main/src/app/profil/page.tsx"
click node_profile_ui "https://github.com/massdann/project-bnsp/blob/main/src/app/profil/ProfilClient.tsx"
click node_countdown "https://github.com/massdann/project-bnsp/blob/main/src/components/ui/CountdownTimer.tsx"
click node_login_page "https://github.com/massdann/project-bnsp/blob/main/src/app/login/page.tsx"
click node_register_page "https://github.com/massdann/project-bnsp/blob/main/src/app/register/page.tsx"
click node_auth_actions "https://github.com/massdann/project-bnsp/blob/main/src/actions/auth.ts"
click node_auth "https://github.com/massdann/project-bnsp/blob/main/src/lib/auth.ts"
click node_auth_route "https://github.com/massdann/project-bnsp/blob/main/src/app/api/auth/%5B...nextauth%5D/route.ts"
click node_court_admin "https://github.com/massdann/project-bnsp/blob/main/src/app/admin/lapangan/page.tsx"
click node_court_editor "https://github.com/massdann/project-bnsp/blob/main/src/app/admin/lapangan/EditLapanganModal.tsx"
click node_court_actions "https://github.com/massdann/project-bnsp/blob/main/src/actions/adminLapangan.ts"
click node_verification "https://github.com/massdann/project-bnsp/blob/main/src/app/admin/verifikasi/page.tsx"
click node_verification_actions "https://github.com/massdann/project-bnsp/blob/main/src/actions/adminVerifikasi.ts"
click node_reports_page "https://github.com/massdann/project-bnsp/blob/main/src/app/admin/laporan/page.tsx"
click node_reports_ui "https://github.com/massdann/project-bnsp/blob/main/src/app/admin/laporan/LaporanClient.tsx"
click node_admin_dashboard "https://github.com/massdann/project-bnsp/blob/main/src/app/admin/page.tsx"
click node_transaction_actions "https://github.com/massdann/project-bnsp/blob/main/src/actions/transaksi.ts"
click node_checkout "https://github.com/massdann/project-bnsp/blob/main/src/app/api/payments/checkout/route.ts"
click node_expiration "https://github.com/massdann/project-bnsp/blob/main/src/app/api/cron/expire-reservasi/route.ts"
click node_database "https://github.com/massdann/project-bnsp/blob/main/src/lib/db.ts"
click node_schema "https://github.com/massdann/project-bnsp/blob/main/src/db/schema.ts"
click node_pusher_server "https://github.com/massdann/project-bnsp/blob/main/src/lib/pusher.ts"
click node_pusher_client "https://github.com/massdann/project-bnsp/blob/main/src/lib/pusher-client.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_home,node_court_list,node_court_detail,node_schedule,node_reservation_actions,node_profile_page,node_profile_ui,node_countdown toneBlue
class node_login_page,node_register_page,node_auth_actions,node_auth,node_auth_route toneAmber
class node_court_admin,node_court_editor,node_court_actions,node_verification,node_verification_actions,node_reports_page,node_reports_ui,node_admin_dashboard,node_transaction_actions,node_checkout,node_expiration toneMint
class node_database,node_schema,node_pusher_server,node_pusher_client toneRose
class node_customer,node_admin_user,node_pusher_service toneIndigo
```

## Components

### Reservations

- [Court discovery](https://github.com/massdann/project-bnsp/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Court schedule](https://github.com/massdann/project-bnsp/blob/main/src/app/reservasi/page.tsx): `src/app/reservasi/page.tsx`
- [Court booking page](https://github.com/massdann/project-bnsp/blob/main/src/app/reservasi/%5Bid%5D/page.tsx): `src/app/reservasi/[id]/page.tsx`
- [Schedule and booking UI](https://github.com/massdann/project-bnsp/blob/main/src/components/booking/JadwalLapangan.tsx): `src/components/booking/JadwalLapangan.tsx`
- [Reservation actions](https://github.com/massdann/project-bnsp/blob/main/src/actions/reservasi.ts): `src/actions/reservasi.ts`
- [Booking profile page](https://github.com/massdann/project-bnsp/blob/main/src/app/profil/page.tsx): `src/app/profil/page.tsx`
- [Profile and invoice UI](https://github.com/massdann/project-bnsp/blob/main/src/app/profil/ProfilClient.tsx): `src/app/profil/ProfilClient.tsx`
- [Payment countdown](https://github.com/massdann/project-bnsp/blob/main/src/components/ui/CountdownTimer.tsx): `src/components/ui/CountdownTimer.tsx`

### Identity

- [Login page](https://github.com/massdann/project-bnsp/blob/main/src/app/login/page.tsx): `src/app/login/page.tsx`
- [Registration page](https://github.com/massdann/project-bnsp/blob/main/src/app/register/page.tsx): `src/app/register/page.tsx`
- [Authentication actions](https://github.com/massdann/project-bnsp/blob/main/src/actions/auth.ts): `src/actions/auth.ts`
- [Credentials and sessions](https://github.com/massdann/project-bnsp/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [Auth API route](https://github.com/massdann/project-bnsp/blob/main/src/app/api/auth/%5B...nextauth%5D/route.ts): `src/app/api/auth/[...nextauth]/route.ts`

### Administration

- [Court management](https://github.com/massdann/project-bnsp/blob/main/src/app/admin/lapangan/page.tsx): `src/app/admin/lapangan/page.tsx`
- [Court editor](https://github.com/massdann/project-bnsp/blob/main/src/app/admin/lapangan/EditLapanganModal.tsx): `src/app/admin/lapangan/EditLapanganModal.tsx`
- [Court actions](https://github.com/massdann/project-bnsp/blob/main/src/actions/adminLapangan.ts): `src/actions/adminLapangan.ts`
- [Payment verification](https://github.com/massdann/project-bnsp/blob/main/src/app/admin/verifikasi/page.tsx): `src/app/admin/verifikasi/page.tsx`
- [Verification actions](https://github.com/massdann/project-bnsp/blob/main/src/actions/adminVerifikasi.ts): `src/actions/adminVerifikasi.ts`
- [Transaction report page](https://github.com/massdann/project-bnsp/blob/main/src/app/admin/laporan/page.tsx): `src/app/admin/laporan/page.tsx`
- [Report and export UI](https://github.com/massdann/project-bnsp/blob/main/src/app/admin/laporan/LaporanClient.tsx): `src/app/admin/laporan/LaporanClient.tsx`
- [Admin dashboard](https://github.com/massdann/project-bnsp/blob/main/src/app/admin/page.tsx): `src/app/admin/page.tsx`
- [Transaction actions](https://github.com/massdann/project-bnsp/blob/main/src/actions/transaksi.ts): `src/actions/transaksi.ts`
- [Payment checkout](https://github.com/massdann/project-bnsp/blob/main/src/app/api/payments/checkout/route.ts): `src/app/api/payments/checkout/route.ts`
- [Reservation expiration](https://github.com/massdann/project-bnsp/blob/main/src/app/api/cron/expire-reservasi/route.ts): `src/app/api/cron/expire-reservasi/route.ts`

### Data and realtime

- [Postgres database](https://github.com/massdann/project-bnsp/blob/main/src/lib/db.ts): `src/lib/db.ts`
- [Domain tables](https://github.com/massdann/project-bnsp/blob/main/src/db/schema.ts): `src/db/schema.ts`
- [Realtime publisher](https://github.com/massdann/project-bnsp/blob/main/src/lib/pusher.ts): `src/lib/pusher.ts`
- [Realtime client](https://github.com/massdann/project-bnsp/blob/main/src/lib/pusher-client.ts): `src/lib/pusher-client.ts`

### Other components

- **Customer**
- **Administrator**
- **Pusher service**

## Connections

- Customer → Login page: opens (evidence: `src/app/login/page.tsx`)
- Customer → Registration page: registers (evidence: `src/app/register/page.tsx`)
- Login page → Authentication actions: submits credentials (evidence: `src/app/login/page.tsx`)
- Registration page → Authentication actions: submits registration (evidence: `src/app/register/page.tsx`)
- Authentication actions → Credentials and sessions: signs in (evidence: `src/actions/auth.ts`)
- Credentials and sessions → Postgres database: checks accounts (evidence: `src/lib/auth.ts`)
- Auth API route → Credentials and sessions: uses handlers (evidence: `src/app/api/auth/[...nextauth]/route.ts`)
- Customer → Court discovery: browses
- Court discovery → Postgres database: reads courts (evidence: `src/app/page.tsx`)
- Court schedule → Postgres database: reads courts (evidence: `src/app/reservasi/page.tsx`)
- Court booking page → Schedule and booking UI: renders (evidence: `src/app/reservasi/[id]/page.tsx`)
- Schedule and booking UI → Reservation actions: requests slot actions (evidence: `src/components/booking/JadwalLapangan.tsx`)
- Reservation actions → Postgres database: reads and writes (evidence: `src/actions/reservasi.ts`)
- Schedule and booking UI → Payment countdown: renders (evidence: `src/components/booking/JadwalLapangan.tsx`)
- Schedule and booking UI → Realtime client: subscribes (evidence: `src/components/booking/JadwalLapangan.tsx`)
- Booking profile page → Profile and invoice UI: renders (evidence: `src/app/profil/page.tsx`)
- Profile and invoice UI → Transaction actions: cancels booking (evidence: `src/app/profil/ProfilClient.tsx`)
- Profile and invoice UI → Realtime client: subscribes (evidence: `src/app/profil/ProfilClient.tsx`)
- Profile and invoice UI → Payment checkout: links to payment
- Administrator → Court management: manages courts
- Court management → Court editor: renders (evidence: `src/app/admin/lapangan/page.tsx`)
- Court editor → Court actions: submits changes (evidence: `src/app/admin/lapangan/EditLapanganModal.tsx`)
- Court management → Court actions: uses actions (evidence: `src/app/admin/lapangan/page.tsx`)
- Court actions → Postgres database: reads and writes (evidence: `src/actions/adminLapangan.ts`)
- Administrator → Payment verification: reviews payments
- Payment verification → Verification actions: uses actions
- Verification actions → Postgres database: reads and writes (evidence: `src/actions/adminVerifikasi.ts`)
- Transaction report page → Report and export UI: renders (evidence: `src/app/admin/laporan/page.tsx`)
- Transaction report page → Postgres database: reads transactions (evidence: `src/app/admin/laporan/page.tsx`)
- Administrator → Transaction report page: reviews reports
- Admin dashboard → Postgres database: reads summary data (evidence: `src/app/admin/page.tsx`)
- Transaction actions → Postgres database: reads and writes (evidence: `src/actions/transaksi.ts`)
- Payment checkout → Postgres database: reads and updates (evidence: `src/app/api/payments/checkout/route.ts`)
- Payment checkout → Realtime publisher: publishes payment (evidence: `src/app/api/payments/checkout/route.ts`)
- Reservation expiration → Postgres database: expires records (evidence: `src/app/api/cron/expire-reservasi/route.ts`)
- Reservation actions → Realtime publisher: publishes slot events (evidence: `src/actions/reservasi.ts`)
- Realtime publisher → Pusher service: sends events
- Realtime client → Pusher service: receives events
- Postgres database → Domain tables: uses schema (evidence: `src/lib/db.ts`)
