# michael-franklyn-mdf/drink_pass architecture

> Architecture diagram of the GitHub repository michael-franklyn-mdf/drink_pass, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/michael-franklyn-mdf/drink_pass
- Repository: https://github.com/michael-franklyn-mdf/drink_pass

## Overview

Drink Pass is a staff drink-voucher system with a desktop Admin, bartender scanning experience, and Supabase-backed live events and card APIs. The main workflow routes an operator to Admin or Bartender; Admin manages events, guests, and reporting, while Bartender scans vouchers and manages drink stock. Event data uses either demo local storage or live Supabase RPCs. Card lookup and redemption use separate Edge Function entry points. The README identifies a Flutter bartender app, but its implementation is not present in the supplied tree; relationships beyond the visible Android host entry point are omitted.

Main entry points: [`src/Admin.jsx`](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/Admin.jsx) (Admin console), [`src/eventStore.js`](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/eventStore.js) (Store selector), [`src/App.jsx`](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/App.jsx) (Role router), [`src/lib/liveEventStore.js`](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/lib/liveEventStore.js) (Live event store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operator["Operator experience"]
  node_app["Role router<br/>[App.jsx]"]
  node_admin["Admin console<br/>[Admin.jsx]"]
  node_event_setup["Event setup"]
  node_overview["Event overview<br/>[Overview.jsx]"]
  node_bulk_cards["Bulk card export<br/>[BulkCardDialog.jsx]"]
  node_guest_card["Guest card management"]
  node_bartender["Bartender scanner<br/>[Bartender.jsx]"]
  node_drinks["Drink stock"]
  node_stock_dialog["Stock dialog<br/>[StockDialog.jsx]"]
  node_nav["Section navigation<br/>[BottomNav.jsx]"]
  node_gate["Live event gate<br/>[LiveEventGate.jsx]"]
  node_session["Operator session<br/>[session.js]"]
  node_ui["Shared UI<br/>[ui.jsx]"]
end

subgraph group_eventdata["Event data"]
  node_event_store["Store selector<br/>[eventStore.js]"]
  node_demo_store[("Demo event store<br/>[demoEventStore.js]")]
  node_live_store["Live event store<br/>[liveEventStore.js]"]
  node_supabase_client["Supabase client<br/>[supabaseClient.js]"]
  node_stats["Overview statistics<br/>[overviewStats.js]"]
end

subgraph group_cards["Card services"]
  node_card_export["Card export utilities<br/>[cardExport.js]"]
  node_card_report["Card reporting<br/>[cardReport.js]"]
  node_guest_template["Guest templates<br/>[guestTemplate.js]"]
  node_lookup["Card lookup endpoint<br/>[index.ts]"]
  node_redeem["Card redemption endpoint<br/>[index.ts]"]
  node_serve_card["Card request service<br/>[serve-card.ts]"]
  node_card_api["Card validation API<br/>[card-api.ts]"]
end

subgraph group_mobile["Mobile host"]
  node_flutter_host["Android host<br/>[MainActivity.kt]"]
end

node_operator(("Operator"))
node_supabase[("Supabase")]

node_operator -->|"opens"| node_app
node_app -->|"wraps live roles"| node_gate
node_app -->|"routes Admin"| node_admin
node_app -->|"routes Bartender"| node_bartender
node_app -->|"selects backend"| node_event_store
node_app -->|"uses role UI"| node_ui
node_admin -->|"renders"| node_event_setup
node_admin -->|"renders"| node_overview
node_admin -->|"opens"| node_bulk_cards
node_admin -->|"opens"| node_guest_card
node_admin -->|"builds reports"| node_card_report
node_admin -->|"uses templates"| node_guest_template
node_admin -->|"manages guests"| node_event_store
node_admin -->|"uses controls"| node_ui
node_event_setup -->|"manages events"| node_event_store
node_overview -->|"computes summaries"| node_stats
node_overview -->|"uses event date"| node_event_setup
node_overview -->|"reads event data"| node_event_store
node_bulk_cards -->|"exports cards"| node_card_export
node_bulk_cards -->|"requests card data"| node_live_store
node_guest_card -->|"manages card"| node_live_store
node_bartender -->|"redeems voucher"| node_event_store
node_bartender -->|"renders section"| node_drinks
node_bartender -->|"renders navigation"| node_nav
node_drinks -->|"manages stock"| node_event_store
node_drinks -->|"opens"| node_stock_dialog
node_drinks -->|"uses controls"| node_ui
node_gate -->|"loads live event"| node_live_store
node_gate -->|"checks backend"| node_supabase_client
node_gate -->|"uses session"| node_session
node_gate -->|"uses screens"| node_ui
node_event_store -->|"selects demo"| node_demo_store
node_event_store -->|"selects live"| node_live_store
node_live_store -->|"calls RPC"| node_supabase_client
node_live_store -->|"uses QR prefix"| node_demo_store
node_stats -->|"reads demo data"| node_demo_store
node_lookup -->|"serves lookup"| node_serve_card
node_redeem -->|"serves redemption"| node_serve_card
node_serve_card -->|"creates handler"| node_card_api
node_serve_card -->|"invokes card RPCs"| node_supabase

click node_app "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/App.jsx"
click node_admin "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/Admin.jsx"
click node_event_setup "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/AdminEventSetup.jsx"
click node_overview "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/Overview.jsx"
click node_bulk_cards "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/BulkCardDialog.jsx"
click node_guest_card "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/GuestCardDialog.jsx"
click node_bartender "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/Bartender.jsx"
click node_drinks "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/BartenderDrinks.jsx"
click node_stock_dialog "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/StockDialog.jsx"
click node_nav "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/BottomNav.jsx"
click node_gate "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/LiveEventGate.jsx"
click node_session "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/session.js"
click node_ui "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/ui.jsx"
click node_event_store "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/eventStore.js"
click node_demo_store "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/demoEventStore.js"
click node_live_store "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/lib/liveEventStore.js"
click node_supabase_client "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/lib/supabaseClient.js"
click node_stats "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/overviewStats.js"
click node_card_export "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/cardExport.js"
click node_card_report "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/cardReport.js"
click node_guest_template "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/guestTemplate.js"
click node_lookup "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/supabase/functions/lookup/index.ts"
click node_redeem "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/supabase/functions/redeem/index.ts"
click node_serve_card "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/supabase/functions/_shared/serve-card.ts"
click node_card_api "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/supabase/functions/_shared/card-api.ts"
click node_flutter_host "https://github.com/michael-franklyn-mdf/drink_pass/blob/main/bartender/android/app/src/main/kotlin/com/drinkpass/drink_pass_bartender/MainActivity.kt"

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_admin,node_event_setup,node_overview,node_bulk_cards,node_guest_card,node_bartender,node_drinks,node_stock_dialog,node_nav,node_gate,node_session,node_ui toneBlue
class node_event_store,node_demo_store,node_live_store,node_supabase_client,node_stats,node_supabase toneAmber
class node_card_export,node_card_report,node_guest_template,node_lookup,node_redeem,node_serve_card,node_card_api toneMint
class node_flutter_host toneRose
class node_operator toneIndigo
```

## Components

### Operator experience

- [Role router](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/App.jsx): `src/App.jsx`
- [Admin console](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/Admin.jsx): `src/Admin.jsx`
- [Event setup](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/AdminEventSetup.jsx): `src/AdminEventSetup.jsx`
- [Event overview](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/Overview.jsx): `src/Overview.jsx`
- [Bulk card export](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/BulkCardDialog.jsx): `src/BulkCardDialog.jsx`
- [Guest card management](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/GuestCardDialog.jsx): `src/GuestCardDialog.jsx`
- [Bartender scanner](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/Bartender.jsx): `src/Bartender.jsx`
- [Drink stock](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/BartenderDrinks.jsx): `src/BartenderDrinks.jsx`
- [Stock dialog](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/StockDialog.jsx): `src/StockDialog.jsx`
- [Section navigation](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/BottomNav.jsx): `src/BottomNav.jsx`
- [Live event gate](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/LiveEventGate.jsx): `src/LiveEventGate.jsx`
- [Operator session](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/session.js): `src/session.js`
- [Shared UI](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/ui.jsx): `src/ui.jsx`

### Event data

- [Store selector](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/eventStore.js): `src/eventStore.js`
- [Demo event store](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/demoEventStore.js): `src/demoEventStore.js`
- [Live event store](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/lib/liveEventStore.js): `src/lib/liveEventStore.js`
- [Supabase client](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/lib/supabaseClient.js): `src/lib/supabaseClient.js`
- [Overview statistics](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/overviewStats.js): `src/overviewStats.js`

### Card services

- [Card export utilities](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/cardExport.js): `src/cardExport.js`
- [Card reporting](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/cardReport.js): `src/cardReport.js`
- [Guest templates](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/src/guestTemplate.js): `src/guestTemplate.js`
- [Card lookup endpoint](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/supabase/functions/lookup/index.ts): `supabase/functions/lookup/index.ts`
- [Card redemption endpoint](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/supabase/functions/redeem/index.ts): `supabase/functions/redeem/index.ts`
- [Card request service](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/supabase/functions/_shared/serve-card.ts): `supabase/functions/_shared/serve-card.ts`
- [Card validation API](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/supabase/functions/_shared/card-api.ts): `supabase/functions/_shared/card-api.ts`

### Mobile host

- [Android host](https://github.com/michael-franklyn-mdf/drink_pass/blob/main/bartender/android/app/src/main/kotlin/com/drinkpass/drink_pass_bartender/MainActivity.kt): `bartender/android/app/src/main/kotlin/com/drinkpass/drink_pass_bartender/MainActivity.kt`

### Other components

- **Operator**
- **Supabase**

## Connections

- Operator → Role router: opens (evidence: `src/App.jsx`)
- Role router → Live event gate: wraps live roles (evidence: `src/App.jsx`)
- Role router → Admin console: routes Admin (evidence: `src/App.jsx`)
- Role router → Bartender scanner: routes Bartender (evidence: `src/App.jsx`)
- Role router → Store selector: selects backend (evidence: `src/App.jsx`)
- Role router → Shared UI: uses role UI (evidence: `src/App.jsx`)
- Admin console → Event setup: renders (evidence: `src/Admin.jsx`)
- Admin console → Event overview: renders (evidence: `src/Admin.jsx`)
- Admin console → Bulk card export: opens (evidence: `src/Admin.jsx`)
- Admin console → Guest card management: opens (evidence: `src/Admin.jsx`)
- Admin console → Card reporting: builds reports (evidence: `src/Admin.jsx`)
- Admin console → Guest templates: uses templates (evidence: `src/Admin.jsx`)
- Admin console → Store selector: manages guests (evidence: `src/Admin.jsx`)
- Admin console → Shared UI: uses controls (evidence: `src/Admin.jsx`)
- Event setup → Store selector: manages events (evidence: `src/AdminEventSetup.jsx`)
- Event overview → Overview statistics: computes summaries (evidence: `src/Overview.jsx`)
- Event overview → Event setup: uses event date (evidence: `src/Overview.jsx`)
- Event overview → Store selector: reads event data (evidence: `src/Overview.jsx`)
- Bulk card export → Card export utilities: exports cards (evidence: `src/BulkCardDialog.jsx`)
- Bulk card export → Live event store: requests card data (evidence: `src/BulkCardDialog.jsx`)
- Guest card management → Live event store: manages card (evidence: `src/GuestCardDialog.jsx`)
- Bartender scanner → Store selector: redeems voucher (evidence: `src/Bartender.jsx`)
- Bartender scanner → Drink stock: renders section (evidence: `src/Bartender.jsx`)
- Bartender scanner → Section navigation: renders navigation (evidence: `src/Bartender.jsx`)
- Drink stock → Store selector: manages stock (evidence: `src/BartenderDrinks.jsx`)
- Drink stock → Stock dialog: opens (evidence: `src/BartenderDrinks.jsx`)
- Drink stock → Shared UI: uses controls (evidence: `src/BartenderDrinks.jsx`)
- Live event gate → Live event store: loads live event (evidence: `src/LiveEventGate.jsx`)
- Live event gate → Supabase client: checks backend (evidence: `src/LiveEventGate.jsx`)
- Live event gate → Operator session: uses session (evidence: `src/LiveEventGate.jsx`)
- Live event gate → Shared UI: uses screens (evidence: `src/LiveEventGate.jsx`)
- Store selector → Demo event store: selects demo (evidence: `src/eventStore.js`)
- Store selector → Live event store: selects live (evidence: `src/eventStore.js`)
- Live event store → Supabase client: calls RPC (evidence: `src/lib/liveEventStore.js`)
- Live event store → Demo event store: uses QR prefix (evidence: `src/lib/liveEventStore.js`)
- Overview statistics → Demo event store: reads demo data (evidence: `src/overviewStats.js`)
- Card lookup endpoint → Card request service: serves lookup (evidence: `supabase/functions/lookup/index.ts`)
- Card redemption endpoint → Card request service: serves redemption (evidence: `supabase/functions/redeem/index.ts`)
- Card request service → Card validation API: creates handler (evidence: `supabase/functions/_shared/serve-card.ts`)
- Card request service → Supabase: invokes card RPCs (evidence: `supabase/functions/_shared/serve-card.ts`)
