# en-gu/e-ticket-bapenda architecture

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

- Interactive diagram: https://gitdiagram.com/en-gu/e-ticket-bapenda
- Repository: https://github.com/en-gu/e-ticket-bapenda

## Overview

This is a Next.js online queue-ticketing system for Bapenda Kabupaten Garut: visitors register and track tickets, while officers validate arrivals and manage the queue, and admins manage services, sessions, tickets, and reports. The graph preserves those distinct stages and the shared Supabase-backed data layer. Some UI-to-API links are documented at the product level but not shown in sampled source, so those links are dashed; unsampled subsystems are represented by their existing directories.

Main entry points: [`frontend/src/app/admin/dashboard/page.tsx`](https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/admin/dashboard/page.tsx) (Admin dashboard), [`frontend/src/lib/supabase-server.ts`](https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/lib/supabase-server.ts) (Server database client), [`frontend/src/app/petugas/dashboard/page.tsx`](https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/petugas/dashboard/page.tsx) (Queue dashboard), [`frontend/src/app/daftar/page.tsx`](https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/daftar/page.tsx) (Ticket registration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Visitor portal"]
  node_registration["Ticket registration<br/>[page.tsx]"]
  node_service_options["Services and sessions"]
  node_create_ticket["Create ticket<br/>[route.ts]"]
  node_ticket_lookup["Track ticket<br/>[page.tsx]"]
  node_ticket_query["Ticket lookup API<br/>[route.ts]"]
  node_ticket_page["E-ticket page<br/>[page.tsx]"]
  node_ticket_client["Print and download<br/>[ETicketClient.tsx]"]
  node_ticket_display["Ticket presentation<br/>[ETicket.tsx]"]
end

subgraph group_operations["Officer operations"]
  node_officer_login["Officer login<br/>[page.tsx]"]
  node_login_api["Login API<br/>[route.ts]"]
  node_officer_dashboard["Queue dashboard<br/>[page.tsx]"]
  node_ticket_validation["Ticket validation<br/>[route.ts]"]
  node_queue_actions["Queue actions"]
  node_queue_status["Queue status<br/>[route.ts]"]
end

subgraph group_admin["Admin management"]
  node_admin_dashboard["Admin dashboard<br/>[page.tsx]"]
  node_admin_ticket_ops["Ticket management<br/>[route.ts]"]
  node_service_management["Service management"]
  node_session_management["Session management"]
  node_reporting["Reports<br/>[route.ts]"]
end

subgraph group_data["Shared data layer"]
  node_supabase_client["Server database client<br/>[supabase-server.ts]"]
  node_ticket_store[("Supabase database")]
end

node_visitor(("Visitor"))
node_officer(("Officer"))
node_admin(("Admin"))

node_visitor -->|"registers"| node_registration
node_registration -.->|"chooses options"| node_service_options
node_registration -.->|"submits details"| node_create_ticket
node_create_ticket -->|"uses client"| node_supabase_client
node_supabase_client -.->|"reads and writes"| node_ticket_store
node_visitor -->|"tracks ticket"| node_ticket_lookup
node_ticket_lookup -.->|"looks up ticket"| node_ticket_query
node_ticket_page -->|"renders"| node_ticket_client
node_ticket_client -->|"renders"| node_ticket_display
node_ticket_page -->|"loads ticket"| node_supabase_client
node_officer -->|"signs in"| node_officer_login
node_officer_login -.->|"authenticates"| node_login_api
node_officer -->|"manages queue"| node_officer_dashboard
node_officer_dashboard -.->|"validates code"| node_ticket_validation
node_ticket_validation -->|"reads and updates"| node_supabase_client
node_officer_dashboard -.->|"controls queue"| node_queue_actions
node_officer_dashboard -.->|"views status"| node_queue_status
node_admin -->|"manages system"| node_admin_dashboard
node_admin_dashboard -.->|"manages tickets"| node_admin_ticket_ops
node_admin_dashboard -.->|"manages services"| node_service_management
node_admin_dashboard -.->|"manages sessions"| node_session_management
node_admin_dashboard -.->|"views reports"| node_reporting
node_reporting -->|"queries tickets"| node_supabase_client

click node_registration "https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/daftar/page.tsx"
click node_service_options "https://github.com/en-gu/e-ticket-bapenda/tree/main/frontend/src/app/api"
click node_create_ticket "https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/api/tickets/route.ts"
click node_ticket_lookup "https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/cek/page.tsx"
click node_ticket_query "https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/api/tickets/%5Bcode%5D/route.ts"
click node_ticket_page "https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/tiket/%5BbookingCode%5D/page.tsx"
click node_ticket_client "https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/tiket/%5BbookingCode%5D/ETicketClient.tsx"
click node_ticket_display "https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/components/tiket/ETicket.tsx"
click node_officer_login "https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/petugas/login/page.tsx"
click node_login_api "https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/api/auth/login/route.ts"
click node_officer_dashboard "https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/petugas/dashboard/page.tsx"
click node_ticket_validation "https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/api/petugas/scan/route.ts"
click node_queue_actions "https://github.com/en-gu/e-ticket-bapenda/tree/main/frontend/src/app/api/petugas"
click node_queue_status "https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/api/queue/status/route.ts"
click node_admin_dashboard "https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/admin/dashboard/page.tsx"
click node_admin_ticket_ops "https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/api/admin/tickets/route.ts"
click node_service_management "https://github.com/en-gu/e-ticket-bapenda/tree/main/frontend/src/app/api/admin/services"
click node_session_management "https://github.com/en-gu/e-ticket-bapenda/tree/main/frontend/src/app/api/admin/sessions"
click node_reporting "https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/api/admin/laporan/route.ts"
click node_supabase_client "https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/lib/supabase-server.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_registration,node_service_options,node_create_ticket,node_ticket_lookup,node_ticket_query,node_ticket_page,node_ticket_client,node_ticket_display toneBlue
class node_officer_login,node_login_api,node_officer_dashboard,node_ticket_validation,node_queue_actions,node_queue_status toneAmber
class node_admin_dashboard,node_admin_ticket_ops,node_service_management,node_session_management,node_reporting toneMint
class node_supabase_client,node_ticket_store toneRose
class node_visitor,node_officer,node_admin toneIndigo
```

## Components

### Visitor portal

- [Ticket registration](https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/daftar/page.tsx): `frontend/src/app/daftar/page.tsx`
- [Services and sessions](https://github.com/en-gu/e-ticket-bapenda/tree/main/frontend/src/app/api): `frontend/src/app/api`
- [Create ticket](https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/api/tickets/route.ts): `frontend/src/app/api/tickets/route.ts`
- [Track ticket](https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/cek/page.tsx): `frontend/src/app/cek/page.tsx`
- [Ticket lookup API](https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/api/tickets/%5Bcode%5D/route.ts): `frontend/src/app/api/tickets/[code]/route.ts`
- [E-ticket page](https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/tiket/%5BbookingCode%5D/page.tsx): `frontend/src/app/tiket/[bookingCode]/page.tsx`
- [Print and download](https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/tiket/%5BbookingCode%5D/ETicketClient.tsx): `frontend/src/app/tiket/[bookingCode]/ETicketClient.tsx`
- [Ticket presentation](https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/components/tiket/ETicket.tsx): `frontend/src/components/tiket/ETicket.tsx`

### Officer operations

- [Officer login](https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/petugas/login/page.tsx): `frontend/src/app/petugas/login/page.tsx`
- [Login API](https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/api/auth/login/route.ts): `frontend/src/app/api/auth/login/route.ts`
- [Queue dashboard](https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/petugas/dashboard/page.tsx): `frontend/src/app/petugas/dashboard/page.tsx`
- [Ticket validation](https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/api/petugas/scan/route.ts): `frontend/src/app/api/petugas/scan/route.ts`
- [Queue actions](https://github.com/en-gu/e-ticket-bapenda/tree/main/frontend/src/app/api/petugas): `frontend/src/app/api/petugas`
- [Queue status](https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/api/queue/status/route.ts): `frontend/src/app/api/queue/status/route.ts`

### Admin management

- [Admin dashboard](https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/admin/dashboard/page.tsx): `frontend/src/app/admin/dashboard/page.tsx`
- [Ticket management](https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/api/admin/tickets/route.ts): `frontend/src/app/api/admin/tickets/route.ts`
- [Service management](https://github.com/en-gu/e-ticket-bapenda/tree/main/frontend/src/app/api/admin/services): `frontend/src/app/api/admin/services`
- [Session management](https://github.com/en-gu/e-ticket-bapenda/tree/main/frontend/src/app/api/admin/sessions): `frontend/src/app/api/admin/sessions`
- [Reports](https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/app/api/admin/laporan/route.ts): `frontend/src/app/api/admin/laporan/route.ts`

### Shared data layer

- [Server database client](https://github.com/en-gu/e-ticket-bapenda/blob/main/frontend/src/lib/supabase-server.ts): `frontend/src/lib/supabase-server.ts`
- **Supabase database**

### Other components

- **Visitor**
- **Officer**
- **Admin**

## Connections

- Visitor → Ticket registration: registers (evidence: `README.md`)
- Ticket registration → Services and sessions: chooses options
- Ticket registration → Create ticket: submits details
- Create ticket → Server database client: uses client (evidence: `frontend/src/app/api/tickets/route.ts`)
- Server database client → Supabase database: reads and writes
- Visitor → Track ticket: tracks ticket (evidence: `README.md`)
- Track ticket → Ticket lookup API: looks up ticket
- E-ticket page → Print and download: renders (evidence: `frontend/src/app/tiket/[bookingCode]/page.tsx`)
- Print and download → Ticket presentation: renders (evidence: `frontend/src/app/tiket/[bookingCode]/ETicketClient.tsx`)
- E-ticket page → Server database client: loads ticket (evidence: `frontend/src/app/tiket/[bookingCode]/page.tsx`)
- Officer → Officer login: signs in (evidence: `README.md`)
- Officer login → Login API: authenticates
- Officer → Queue dashboard: manages queue (evidence: `README.md`)
- Queue dashboard → Ticket validation: validates code
- Ticket validation → Server database client: reads and updates (evidence: `frontend/src/app/api/petugas/scan/route.ts`)
- Queue dashboard → Queue actions: controls queue
- Queue dashboard → Queue status: views status
- Admin → Admin dashboard: manages system (evidence: `README.md`)
- Admin dashboard → Ticket management: manages tickets
- Admin dashboard → Service management: manages services
- Admin dashboard → Session management: manages sessions
- Admin dashboard → Reports: views reports
- Reports → Server database client: queries tickets (evidence: `frontend/src/app/api/admin/laporan/route.ts`)
