# rotiehzk/ept-cantina architecture

> Architecture diagram of the GitHub repository rotiehzk/ept-cantina, 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/rotiehzk/ept-cantina
- Repository: https://github.com/rotiehzk/ept-cantina

## Overview

EPT Cantina is a responsive school-lunch planning demo. Students browse weekly menus, select and confirm a meal choice, and review their choices; cantina staff view per-day counts and missing responses and can edit demo menus. The README also describes CSV export, fictitious test profiles, server persistence in Cloudflare D1, and offline support. The sampled UI imports the domain week helper and registers the service worker. The documented demo API route is absent from the supplied tree, so its implementation is not mapped; its connection to D1 is documented only at a high level.

Main entry points: [`app/cantina.tsx`](https://github.com/rotiehzk/ept-cantina/blob/main/app/cantina.tsx) (Cantina interface), [`db/index.ts`](https://github.com/rotiehzk/ept-cantina/blob/main/db/index.ts) (D1 access), [`app/page.tsx`](https://github.com/rotiehzk/ept-cantina/blob/main/app/page.tsx) (App entry), [`app`](https://github.com/rotiehzk/ept-cantina/tree/main/app) (Demo data API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Meal experience"]
  node_entry["App entry<br/>[page.tsx]"]
  node_cantina["Cantina interface<br/>[cantina.tsx]"]
  node_meal_choices["Meal choices<br/>[cantina.tsx]"]
  node_staff_panel["Cantina panel<br/>[cantina.tsx]"]
  node_menu_editor["Menu editor<br/>[cantina.tsx]"]
  node_choice_summary["Choice summary<br/>[cantina.tsx]"]
  node_csv_export["CSV export<br/>[cantina.tsx]"]
end

subgraph group_domain["Menu domain"]
  node_demo_profiles["Demo profiles<br/>[domain.ts]"]
  node_week_menus["Weekly menus<br/>[domain.ts]"]
end

subgraph group_persistence["Persistence and access"]
  node_demo_signin["Demo sign-in<br/>[chatgpt-auth.ts]"]
  node_demo_api["Demo data API"]
  node_db_access["D1 access<br/>[index.ts]"]
  node_db_schema["Data schema<br/>[schema.ts]"]
end

subgraph group_offline["Offline support"]
  node_service_worker["Service worker<br/>[sw.js]"]
end

node_student(("Student"))
node_staff(("Cantina staff"))
node_browser(("Browser"))
node_cloudflare_d1[("Cloudflare D1")]

node_student -->|"opens app"| node_entry
node_staff -->|"opens app"| node_entry
node_entry -->|"renders"| node_cantina
node_cantina -->|"uses dates"| node_week_menus
node_cantina -.->|"selects profile"| node_demo_profiles
node_cantina -->|"presents"| node_meal_choices
node_cantina -->|"presents"| node_staff_panel
node_cantina -->|"opens editor"| node_menu_editor
node_cantina -.->|"shows choices"| node_choice_summary
node_cantina -.->|"exports"| node_csv_export
node_student -.->|"chooses meals"| node_meal_choices
node_staff -.->|"reviews counts"| node_staff_panel
node_staff -->|"edits menu"| node_menu_editor
node_cantina -.->|"loads and saves"| node_demo_api
node_demo_api -.->|"uses database"| node_db_access
node_db_access -->|"configures schema"| node_db_schema
node_db_access -->|"accesses"| node_cloudflare_d1
node_browser -->|"registers"| node_service_worker
node_student -.->|"starts demo access"| node_demo_signin

click node_entry "https://github.com/rotiehzk/ept-cantina/blob/main/app/page.tsx"
click node_cantina "https://github.com/rotiehzk/ept-cantina/blob/main/app/cantina.tsx"
click node_meal_choices "https://github.com/rotiehzk/ept-cantina/blob/main/app/cantina.tsx"
click node_staff_panel "https://github.com/rotiehzk/ept-cantina/blob/main/app/cantina.tsx"
click node_menu_editor "https://github.com/rotiehzk/ept-cantina/blob/main/app/cantina.tsx"
click node_choice_summary "https://github.com/rotiehzk/ept-cantina/blob/main/app/cantina.tsx"
click node_csv_export "https://github.com/rotiehzk/ept-cantina/blob/main/app/cantina.tsx"
click node_demo_profiles "https://github.com/rotiehzk/ept-cantina/blob/main/app/domain.ts"
click node_week_menus "https://github.com/rotiehzk/ept-cantina/blob/main/app/domain.ts"
click node_demo_signin "https://github.com/rotiehzk/ept-cantina/blob/main/app/chatgpt-auth.ts"
click node_demo_api "https://github.com/rotiehzk/ept-cantina/tree/main/app"
click node_db_access "https://github.com/rotiehzk/ept-cantina/blob/main/db/index.ts"
click node_db_schema "https://github.com/rotiehzk/ept-cantina/blob/main/db/schema.ts"
click node_service_worker "https://github.com/rotiehzk/ept-cantina/blob/main/public/sw.js"

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_entry,node_cantina,node_meal_choices,node_staff_panel,node_menu_editor,node_choice_summary,node_csv_export,node_browser toneBlue
class node_demo_profiles,node_week_menus,node_cloudflare_d1 toneAmber
class node_demo_signin,node_demo_api,node_db_access,node_db_schema toneMint
class node_service_worker toneRose
class node_student,node_staff toneIndigo
```

## Components

### Meal experience

- [App entry](https://github.com/rotiehzk/ept-cantina/blob/main/app/page.tsx): `app/page.tsx`
- [Cantina interface](https://github.com/rotiehzk/ept-cantina/blob/main/app/cantina.tsx): `app/cantina.tsx`
- [Meal choices](https://github.com/rotiehzk/ept-cantina/blob/main/app/cantina.tsx): `app/cantina.tsx`
- [Cantina panel](https://github.com/rotiehzk/ept-cantina/blob/main/app/cantina.tsx): `app/cantina.tsx`
- [Menu editor](https://github.com/rotiehzk/ept-cantina/blob/main/app/cantina.tsx): `app/cantina.tsx`
- [Choice summary](https://github.com/rotiehzk/ept-cantina/blob/main/app/cantina.tsx): `app/cantina.tsx`
- [CSV export](https://github.com/rotiehzk/ept-cantina/blob/main/app/cantina.tsx): `app/cantina.tsx`

### Menu domain

- [Demo profiles](https://github.com/rotiehzk/ept-cantina/blob/main/app/domain.ts): `app/domain.ts`
- [Weekly menus](https://github.com/rotiehzk/ept-cantina/blob/main/app/domain.ts): `app/domain.ts`

### Persistence and access

- [Demo sign-in](https://github.com/rotiehzk/ept-cantina/blob/main/app/chatgpt-auth.ts): `app/chatgpt-auth.ts`
- [Demo data API](https://github.com/rotiehzk/ept-cantina/tree/main/app): `app`
- [D1 access](https://github.com/rotiehzk/ept-cantina/blob/main/db/index.ts): `db/index.ts`
- [Data schema](https://github.com/rotiehzk/ept-cantina/blob/main/db/schema.ts): `db/schema.ts`

### Offline support

- [Service worker](https://github.com/rotiehzk/ept-cantina/blob/main/public/sw.js): `public/sw.js`

### Other components

- **Student**
- **Cantina staff**
- **Browser**
- **Cloudflare D1**

## Connections

- Student → App entry: opens app
- Cantina staff → App entry: opens app
- App entry → Cantina interface: renders (evidence: `app/page.tsx`)
- Cantina interface → Weekly menus: uses dates (evidence: `app/cantina.tsx`)
- Cantina interface → Demo profiles: selects profile (evidence: `app/cantina.tsx`)
- Cantina interface → Meal choices: presents (evidence: `app/cantina.tsx`)
- Cantina interface → Cantina panel: presents (evidence: `app/cantina.tsx`)
- Cantina interface → Menu editor: opens editor (evidence: `app/cantina.tsx`)
- Cantina interface → Choice summary: shows choices (evidence: `app/cantina.tsx`)
- Cantina interface → CSV export: exports (evidence: `app/cantina.tsx`)
- Student → Meal choices: chooses meals
- Cantina staff → Cantina panel: reviews counts
- Cantina staff → Menu editor: edits menu
- Cantina interface → Demo data API: loads and saves (evidence: `app/cantina.tsx`)
- Demo data API → D1 access: uses database
- D1 access → Data schema: configures schema (evidence: `db/index.ts`)
- D1 access → Cloudflare D1: accesses (evidence: `db/index.ts`)
- Browser → Service worker: registers
- Student → Demo sign-in: starts demo access
