# ayingaran/arscheck architecture

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

- Interactive diagram: https://gitdiagram.com/ayingaran/arscheck
- Repository: https://github.com/ayingaran/arscheck

## Overview

ArsCheck supports exhibition staff from sign-in through admin operations or staff scanning: visitors and tours are managed, tickets are checked against tour windows, and attendance is surfaced in dashboards and analytics. The Next.js page selects the role-specific experience; authenticated API handlers enforce permissions and access Supabase. The README also documents CSV exports and realtime attendance refreshes. Some implementation details were not sampled, so those documented capabilities are shown at subsystem level rather than with speculative internal links.

Main entry points: [`src/components/dashboard.tsx`](https://github.com/ayingaran/arscheck/blob/main/src/components/dashboard.tsx) (Operations dashboard), [`src/app/page.tsx`](https://github.com/ayingaran/arscheck/blob/main/src/app/page.tsx) (App shell and roles), [`src/lib/supabase-server.ts`](https://github.com/ayingaran/arscheck/blob/main/src/lib/supabase-server.ts) (Server Supabase client), [`src/app/api/check-in/route.ts`](https://github.com/ayingaran/arscheck/blob/main/src/app/api/check-in/route.ts) (Check-in validation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Staff experience"]
  node_app["App shell and roles<br/>[page.tsx]"]
  node_login["Sign-in<br/>[login-screen.tsx]"]
  node_dashboard["Operations dashboard<br/>[dashboard.tsx]"]
  node_scanner["QR and manual scanner<br/>[scanner.tsx]"]
  node_ticket["QR ticket display<br/>[ticket-dialog.tsx]"]
  node_analytics["Attendance analytics<br/>[checkin-chart.tsx]"]
  node_ticketanalytics["Ticket distribution"]
end

subgraph group_operations["Visitor and tour operations"]
  node_visitorui["Visitor management dialogs"]
  node_tourui["Tour management dialogs"]
end

subgraph group_services["API and security"]
  node_visitorapi["Visitor routes"]
  node_tourapi["Tour routes"]
  node_checkin["Check-in validation<br/>[route.ts]"]
  node_stats["Dashboard statistics<br/>[route.ts]"]
  node_authz["API role authorization<br/>[api-auth.ts]"]
  node_authfetch["Authenticated API client<br/>[auth-fetch.ts]"]
end

subgraph group_data["Data and integrations"]
  node_types["Domain data types<br/>[types.ts]"]
  node_browserclient["Browser Supabase client"]
  node_serverclient["Server Supabase client<br/>[supabase-server.ts]"]
  node_database[("Supabase PostgreSQL<br/>[schema.sql]")]
  node_supabaseauth["Supabase Auth and Realtime"]
end

node_staff(("Exhibition staff"))

node_staff -->|"uses"| node_app
node_app -->|"shows"| node_login
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_scanner
node_login -->|"authenticates with"| node_browserclient
node_app -->|"reads session"| node_browserclient
node_dashboard -->|"opens"| node_visitorui
node_dashboard -->|"opens"| node_tourui
node_dashboard -->|"displays"| node_ticket
node_dashboard -->|"renders"| node_analytics
node_dashboard -->|"renders"| node_ticketanalytics
node_dashboard -->|"requests"| node_authfetch
node_scanner -->|"submits check-in"| node_authfetch
node_authfetch -->|"gets access token"| node_browserclient
node_scanner -->|"posts ticket code"| node_checkin
node_visitorui -->|"manages visitors"| node_visitorapi
node_tourui -->|"manages tours"| node_tourapi
node_app -->|"loads dashboard data"| node_stats
node_checkin -->|"requires staff or admin"| node_authz
node_visitorapi -->|"checks admin role"| node_authz
node_tourapi -->|"checks admin role"| node_authz
node_stats -->|"checks admin role"| node_authz
node_checkin -->|"gets database client"| node_serverclient
node_visitorapi -->|"accesses database"| node_serverclient
node_tourapi -->|"accesses database"| node_serverclient
node_stats -->|"reads data"| node_serverclient
node_serverclient -->|"queries"| node_database
node_browserclient -->|"uses auth and realtime"| node_supabaseauth
node_app -.->|"refreshes attendance"| node_dashboard
node_dashboard -->|"uses domain records"| node_types
node_checkin -.->|"returns visitor record"| node_types

click node_app "https://github.com/ayingaran/arscheck/blob/main/src/app/page.tsx"
click node_login "https://github.com/ayingaran/arscheck/blob/main/src/components/login-screen.tsx"
click node_dashboard "https://github.com/ayingaran/arscheck/blob/main/src/components/dashboard.tsx"
click node_scanner "https://github.com/ayingaran/arscheck/blob/main/src/components/scanner.tsx"
click node_ticket "https://github.com/ayingaran/arscheck/blob/main/src/components/ticket-dialog.tsx"
click node_analytics "https://github.com/ayingaran/arscheck/blob/main/src/components/checkin-chart.tsx"
click node_ticketanalytics "https://github.com/ayingaran/arscheck/blob/main/src/components/ticket-type-chart.tsx"
click node_visitorui "https://github.com/ayingaran/arscheck/tree/main/src/components"
click node_tourui "https://github.com/ayingaran/arscheck/tree/main/src/components"
click node_visitorapi "https://github.com/ayingaran/arscheck/tree/main/src/app/api/visitors"
click node_tourapi "https://github.com/ayingaran/arscheck/tree/main/src/app/api/tours"
click node_checkin "https://github.com/ayingaran/arscheck/blob/main/src/app/api/check-in/route.ts"
click node_stats "https://github.com/ayingaran/arscheck/blob/main/src/app/api/dashboard-stats/route.ts"
click node_authz "https://github.com/ayingaran/arscheck/blob/main/src/lib/api-auth.ts"
click node_authfetch "https://github.com/ayingaran/arscheck/blob/main/src/lib/auth-fetch.ts"
click node_types "https://github.com/ayingaran/arscheck/blob/main/src/lib/types.ts"
click node_browserclient "https://github.com/ayingaran/arscheck/blob/main/src/lib/supabase-browser.ts"
click node_serverclient "https://github.com/ayingaran/arscheck/blob/main/src/lib/supabase-server.ts"
click node_database "https://github.com/ayingaran/arscheck/blob/main/supabase/schema.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,node_login,node_dashboard,node_scanner,node_ticket,node_analytics,node_ticketanalytics toneBlue
class node_visitorui,node_tourui toneAmber
class node_visitorapi,node_tourapi,node_checkin,node_stats,node_authz,node_authfetch toneMint
class node_types,node_browserclient,node_serverclient,node_database,node_supabaseauth toneRose
class node_staff toneIndigo
```

## Components

### Staff experience

- [App shell and roles](https://github.com/ayingaran/arscheck/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Sign-in](https://github.com/ayingaran/arscheck/blob/main/src/components/login-screen.tsx): `src/components/login-screen.tsx`
- [Operations dashboard](https://github.com/ayingaran/arscheck/blob/main/src/components/dashboard.tsx): `src/components/dashboard.tsx`
- [QR and manual scanner](https://github.com/ayingaran/arscheck/blob/main/src/components/scanner.tsx): `src/components/scanner.tsx`
- [QR ticket display](https://github.com/ayingaran/arscheck/blob/main/src/components/ticket-dialog.tsx): `src/components/ticket-dialog.tsx`
- [Attendance analytics](https://github.com/ayingaran/arscheck/blob/main/src/components/checkin-chart.tsx): `src/components/checkin-chart.tsx`
- [Ticket distribution](https://github.com/ayingaran/arscheck/blob/main/src/components/ticket-type-chart.tsx): `src/components/ticket-type-chart.tsx`

### Visitor and tour operations

- [Visitor management dialogs](https://github.com/ayingaran/arscheck/tree/main/src/components): `src/components`
- [Tour management dialogs](https://github.com/ayingaran/arscheck/tree/main/src/components): `src/components`

### API and security

- [Visitor routes](https://github.com/ayingaran/arscheck/tree/main/src/app/api/visitors): `src/app/api/visitors`
- [Tour routes](https://github.com/ayingaran/arscheck/tree/main/src/app/api/tours): `src/app/api/tours`
- [Check-in validation](https://github.com/ayingaran/arscheck/blob/main/src/app/api/check-in/route.ts): `src/app/api/check-in/route.ts`
- [Dashboard statistics](https://github.com/ayingaran/arscheck/blob/main/src/app/api/dashboard-stats/route.ts): `src/app/api/dashboard-stats/route.ts`
- [API role authorization](https://github.com/ayingaran/arscheck/blob/main/src/lib/api-auth.ts): `src/lib/api-auth.ts`
- [Authenticated API client](https://github.com/ayingaran/arscheck/blob/main/src/lib/auth-fetch.ts): `src/lib/auth-fetch.ts`

### Data and integrations

- [Domain data types](https://github.com/ayingaran/arscheck/blob/main/src/lib/types.ts): `src/lib/types.ts`
- [Browser Supabase client](https://github.com/ayingaran/arscheck/blob/main/src/lib/supabase-browser.ts): `src/lib/supabase-browser.ts`
- [Server Supabase client](https://github.com/ayingaran/arscheck/blob/main/src/lib/supabase-server.ts): `src/lib/supabase-server.ts`
- [Supabase PostgreSQL](https://github.com/ayingaran/arscheck/blob/main/supabase/schema.sql): `supabase/schema.sql`
- **Supabase Auth and Realtime**

### Other components

- **Exhibition staff**

## Connections

- Exhibition staff → App shell and roles: uses (evidence: `README.md`)
- App shell and roles → Sign-in: shows (evidence: `src/app/page.tsx`)
- App shell and roles → Operations dashboard: renders (evidence: `src/app/page.tsx`)
- App shell and roles → QR and manual scanner: renders (evidence: `src/app/page.tsx`)
- Sign-in → Browser Supabase client: authenticates with (evidence: `src/components/login-screen.tsx`)
- App shell and roles → Browser Supabase client: reads session (evidence: `src/app/page.tsx`)
- Operations dashboard → Visitor management dialogs: opens (evidence: `src/components/dashboard.tsx`)
- Operations dashboard → Tour management dialogs: opens (evidence: `src/components/dashboard.tsx`)
- Operations dashboard → QR ticket display: displays (evidence: `src/components/dashboard.tsx`)
- Operations dashboard → Attendance analytics: renders (evidence: `src/components/dashboard.tsx`)
- Operations dashboard → Ticket distribution: renders (evidence: `src/components/dashboard.tsx`)
- Operations dashboard → Authenticated API client: requests (evidence: `src/components/dashboard.tsx`)
- QR and manual scanner → Authenticated API client: submits check-in (evidence: `src/components/scanner.tsx`)
- Authenticated API client → Browser Supabase client: gets access token (evidence: `src/lib/auth-fetch.ts`)
- QR and manual scanner → Check-in validation: posts ticket code (evidence: `src/components/scanner.tsx`)
- Visitor management dialogs → Visitor routes: manages visitors (evidence: `README.md`)
- Tour management dialogs → Tour routes: manages tours (evidence: `README.md`)
- App shell and roles → Dashboard statistics: loads dashboard data (evidence: `src/app/page.tsx`)
- Check-in validation → API role authorization: requires staff or admin (evidence: `src/app/api/check-in/route.ts`)
- Visitor routes → API role authorization: checks admin role (evidence: `README.md`)
- Tour routes → API role authorization: checks admin role (evidence: `README.md`)
- Dashboard statistics → API role authorization: checks admin role (evidence: `README.md`)
- Check-in validation → Server Supabase client: gets database client (evidence: `src/app/api/check-in/route.ts`)
- Visitor routes → Server Supabase client: accesses database (evidence: `src/app/api/visitors/route.ts`)
- Tour routes → Server Supabase client: accesses database (evidence: `src/app/api/tours/route.ts`)
- Dashboard statistics → Server Supabase client: reads data (evidence: `src/app/api/dashboard-stats/route.ts`)
- Server Supabase client → Supabase PostgreSQL: queries (evidence: `README.md`)
- Browser Supabase client → Supabase Auth and Realtime: uses auth and realtime (evidence: `README.md`)
- App shell and roles → Operations dashboard: refreshes attendance (evidence: `src/app/page.tsx`)
- Operations dashboard → Domain data types: uses domain records (evidence: `src/components/dashboard.tsx`)
- Check-in validation → Domain data types: returns visitor record
