# eric-moschen/clandestino-cardapio architecture

> Architecture diagram of the GitHub repository eric-moschen/clandestino-cardapio, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/eric-moschen/clandestino-cardapio
- Repository: https://github.com/eric-moschen/clandestino-cardapio

## Overview

O Clandestino is a restaurant digital menu and service platform: guests browse products or request table service, while staff claim and complete calls; administrators manage catalog, tables, staff, and call history. The map preserves the documented media uploads, push notifications, and admin capabilities. Edges use README statements or indexed excerpts; unsampled admin pages and SQL-backed behavior are represented only where documentation supports them.

Main entry points: [`lib/supabase/server.ts`](https://github.com/eric-moschen/clandestino-cardapio/blob/main/lib/supabase/server.ts) (Server Supabase client), [`app/api/calls/route.ts`](https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/api/calls/route.ts) (Call registration and push), [`components/calls/staff-call-board.tsx`](https://github.com/eric-moschen/clandestino-cardapio/blob/main/components/calls/staff-call-board.tsx) (Staff call board), [`lib/actions/catalog.ts`](https://github.com/eric-moschen/clandestino-cardapio/blob/main/lib/actions/catalog.ts) (Catalog actions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_guest["Guest experience"]
  node_landing["Home and table selection<br/>[page.tsx]"]
  node_mesa["Table request page<br/>[page.tsx]"]
  node_menu_page["Public menu route<br/>[page.tsx]"]
  node_menu["Menu and product details<br/>[menu.tsx]"]
end

subgraph group_service["Table service"]
  node_call_actions["Guest call controls"]
  node_call_button["Table call button"]
  node_call_api["Call registration and push<br/>[route.ts]"]
  node_staff_login["Staff login<br/>[page.tsx]"]
  node_staff_auth["Staff authentication<br/>[staff-auth.ts]"]
  node_staff_board["Staff call board"]
  node_claim["Claim call endpoint<br/>[route.ts]"]
  node_complete["Complete call endpoint<br/>[route.ts]"]
  node_push_controls["Push subscription controls<br/>[enable-push.tsx]"]
  node_push_subscribe["Subscribe endpoint<br/>[route.ts]"]
  node_push_unsubscribe["Unsubscribe endpoint<br/>[route.ts]"]
  node_service_worker["Push service worker<br/>[sw.js]"]
end

subgraph group_admin["Administration"]
  node_admin_login["Admin login<br/>[page.tsx]"]
  node_dashboard["Admin dashboard<br/>[page.tsx]"]
  node_catalog_pages["Catalog management<br/>[page.tsx]"]
  node_categories_page["Category management<br/>[page.tsx]"]
  node_product_form["Product editor<br/>[product-form.tsx]"]
  node_image_upload["Image upload<br/>[image-upload.tsx]"]
  node_video_upload["Video upload<br/>[video-upload.tsx]"]
  node_tables_page["Table management<br/>[page.tsx]"]
  node_staff_page["Staff management<br/>[page.tsx]"]
  node_calls_page["Call history<br/>[page.tsx]"]
end

subgraph group_backend["Backend services"]
  node_admin_auth["Admin authorization<br/>[admin.ts]"]
  node_catalog_actions["Catalog actions<br/>[catalog.ts]"]
  node_ops_actions["Operations actions<br/>[operations.ts]"]
  node_supabase[("Supabase database and storage")]
  node_server_client["Server Supabase client<br/>[server.ts]"]
  node_service_client["Service-role client<br/>[service.ts]"]
end

node_guest(("Guest"))
node_admin_actor(("Administrator"))

node_guest -->|"opens"| node_landing
node_landing -->|"renders"| node_call_actions
node_guest -.->|"opens"| node_menu_page
node_menu_page -->|"renders"| node_menu
node_guest -.->|"opens"| node_mesa
node_mesa -->|"renders"| node_call_button
node_call_actions -.->|"renders"| node_call_button
node_call_button -.->|"submits request"| node_call_api
node_call_api -->|"records call"| node_supabase
node_call_api -->|"loads push recipients"| node_service_client
node_call_api -.->|"notifies staff"| node_staff_board
node_staff_login -->|"uses sign-in"| node_staff_auth
node_staff_auth -->|"authenticates"| node_server_client
node_staff_board -.->|"claims calls"| node_claim
node_staff_board -.->|"completes calls"| node_complete
node_staff_board -->|"pairs with"| node_push_controls
node_push_controls -.->|"submits subscription"| node_push_subscribe
node_push_controls -.->|"removes subscription"| node_push_unsubscribe
node_push_subscribe -->|"saves subscription"| node_supabase
node_push_unsubscribe -->|"deactivates subscription"| node_supabase
node_service_worker -.->|"displays push"| node_guest
node_admin_actor -.->|"signs in"| node_admin_login
node_admin_login -->|"authenticates"| node_server_client
node_admin_auth -->|"checks membership"| node_server_client
node_dashboard -.->|"requires access"| node_admin_auth
node_catalog_pages -->|"invokes changes"| node_catalog_actions
node_categories_page -->|"invokes changes"| node_catalog_actions
node_product_form -->|"submits product"| node_catalog_actions
node_product_form -->|"renders"| node_image_upload
node_product_form -->|"renders"| node_video_upload
node_catalog_actions -.->|"writes catalog"| node_supabase
node_image_upload -.->|"uploads image"| node_supabase
node_video_upload -.->|"uploads video"| node_supabase
node_tables_page -->|"manages tables"| node_ops_actions
node_staff_page -->|"manages staff"| node_ops_actions
node_calls_page -->|"manages calls"| node_ops_actions
node_ops_actions -.->|"updates operations"| node_supabase
node_menu_page -->|"loads menu data"| node_server_client
node_landing -->|"loads active tables"| node_server_client

click node_landing "https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/page.tsx"
click node_mesa "https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/mesa/page.tsx"
click node_menu_page "https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/cardapio/page.tsx"
click node_menu "https://github.com/eric-moschen/clandestino-cardapio/blob/main/components/menu.tsx"
click node_call_actions "https://github.com/eric-moschen/clandestino-cardapio/blob/main/components/calls/landing-actions.tsx"
click node_call_button "https://github.com/eric-moschen/clandestino-cardapio/blob/main/components/calls/call-waiter-button.tsx"
click node_call_api "https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/api/calls/route.ts"
click node_staff_login "https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/garcom/login/page.tsx"
click node_staff_auth "https://github.com/eric-moschen/clandestino-cardapio/blob/main/lib/actions/staff-auth.ts"
click node_staff_board "https://github.com/eric-moschen/clandestino-cardapio/blob/main/components/calls/staff-call-board.tsx"
click node_claim "https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/api/calls/%5Bid%5D/claim/route.ts"
click node_complete "https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/api/calls/%5Bid%5D/complete/route.ts"
click node_push_controls "https://github.com/eric-moschen/clandestino-cardapio/blob/main/components/calls/enable-push.tsx"
click node_push_subscribe "https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/api/push/subscribe/route.ts"
click node_push_unsubscribe "https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/api/push/unsubscribe/route.ts"
click node_service_worker "https://github.com/eric-moschen/clandestino-cardapio/blob/main/public/sw.js"
click node_admin_login "https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/admin/login/page.tsx"
click node_admin_auth "https://github.com/eric-moschen/clandestino-cardapio/blob/main/lib/supabase/admin.ts"
click node_dashboard "https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/admin/(protected)/page.tsx"
click node_catalog_pages "https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/admin/(protected)/products/page.tsx"
click node_categories_page "https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/admin/(protected)/categories/page.tsx"
click node_product_form "https://github.com/eric-moschen/clandestino-cardapio/blob/main/components/admin/product-form.tsx"
click node_image_upload "https://github.com/eric-moschen/clandestino-cardapio/blob/main/components/admin/image-upload.tsx"
click node_video_upload "https://github.com/eric-moschen/clandestino-cardapio/blob/main/components/admin/video-upload.tsx"
click node_catalog_actions "https://github.com/eric-moschen/clandestino-cardapio/blob/main/lib/actions/catalog.ts"
click node_ops_actions "https://github.com/eric-moschen/clandestino-cardapio/blob/main/lib/actions/operations.ts"
click node_tables_page "https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/admin/(protected)/tables/page.tsx"
click node_staff_page "https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/admin/(protected)/staff/page.tsx"
click node_calls_page "https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/admin/(protected)/calls/page.tsx"
click node_server_client "https://github.com/eric-moschen/clandestino-cardapio/blob/main/lib/supabase/server.ts"
click node_service_client "https://github.com/eric-moschen/clandestino-cardapio/blob/main/lib/supabase/service.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_landing,node_mesa,node_menu_page,node_menu toneBlue
class node_call_actions,node_call_button,node_call_api,node_staff_login,node_staff_auth,node_staff_board,node_claim,node_complete,node_push_controls,node_push_subscribe,node_push_unsubscribe,node_service_worker toneAmber
class node_admin_login,node_dashboard,node_catalog_pages,node_categories_page,node_product_form,node_image_upload,node_video_upload,node_tables_page,node_staff_page,node_calls_page toneMint
class node_admin_auth,node_catalog_actions,node_ops_actions,node_supabase,node_server_client,node_service_client toneRose
class node_guest,node_admin_actor toneIndigo
```

## Components

### Guest experience

- [Home and table selection](https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/page.tsx): `app/page.tsx`
- [Table request page](https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/mesa/page.tsx): `app/mesa/page.tsx`
- [Public menu route](https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/cardapio/page.tsx): `app/cardapio/page.tsx`
- [Menu and product details](https://github.com/eric-moschen/clandestino-cardapio/blob/main/components/menu.tsx): `components/menu.tsx`

### Table service

- [Guest call controls](https://github.com/eric-moschen/clandestino-cardapio/blob/main/components/calls/landing-actions.tsx): `components/calls/landing-actions.tsx`
- [Table call button](https://github.com/eric-moschen/clandestino-cardapio/blob/main/components/calls/call-waiter-button.tsx): `components/calls/call-waiter-button.tsx`
- [Call registration and push](https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/api/calls/route.ts): `app/api/calls/route.ts`
- [Staff login](https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/garcom/login/page.tsx): `app/garcom/login/page.tsx`
- [Staff authentication](https://github.com/eric-moschen/clandestino-cardapio/blob/main/lib/actions/staff-auth.ts): `lib/actions/staff-auth.ts`
- [Staff call board](https://github.com/eric-moschen/clandestino-cardapio/blob/main/components/calls/staff-call-board.tsx): `components/calls/staff-call-board.tsx`
- [Claim call endpoint](https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/api/calls/%5Bid%5D/claim/route.ts): `app/api/calls/[id]/claim/route.ts`
- [Complete call endpoint](https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/api/calls/%5Bid%5D/complete/route.ts): `app/api/calls/[id]/complete/route.ts`
- [Push subscription controls](https://github.com/eric-moschen/clandestino-cardapio/blob/main/components/calls/enable-push.tsx): `components/calls/enable-push.tsx`
- [Subscribe endpoint](https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/api/push/subscribe/route.ts): `app/api/push/subscribe/route.ts`
- [Unsubscribe endpoint](https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/api/push/unsubscribe/route.ts): `app/api/push/unsubscribe/route.ts`
- [Push service worker](https://github.com/eric-moschen/clandestino-cardapio/blob/main/public/sw.js): `public/sw.js`

### Administration

- [Admin login](https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/admin/login/page.tsx): `app/admin/login/page.tsx`
- [Admin dashboard](https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/admin/(protected)/page.tsx): `app/admin/(protected)/page.tsx`
- [Catalog management](https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/admin/(protected)/products/page.tsx): `app/admin/(protected)/products/page.tsx`
- [Category management](https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/admin/(protected)/categories/page.tsx): `app/admin/(protected)/categories/page.tsx`
- [Product editor](https://github.com/eric-moschen/clandestino-cardapio/blob/main/components/admin/product-form.tsx): `components/admin/product-form.tsx`
- [Image upload](https://github.com/eric-moschen/clandestino-cardapio/blob/main/components/admin/image-upload.tsx): `components/admin/image-upload.tsx`
- [Video upload](https://github.com/eric-moschen/clandestino-cardapio/blob/main/components/admin/video-upload.tsx): `components/admin/video-upload.tsx`
- [Table management](https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/admin/(protected)/tables/page.tsx): `app/admin/(protected)/tables/page.tsx`
- [Staff management](https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/admin/(protected)/staff/page.tsx): `app/admin/(protected)/staff/page.tsx`
- [Call history](https://github.com/eric-moschen/clandestino-cardapio/blob/main/app/admin/(protected)/calls/page.tsx): `app/admin/(protected)/calls/page.tsx`

### Backend services

- [Admin authorization](https://github.com/eric-moschen/clandestino-cardapio/blob/main/lib/supabase/admin.ts): `lib/supabase/admin.ts`
- [Catalog actions](https://github.com/eric-moschen/clandestino-cardapio/blob/main/lib/actions/catalog.ts): `lib/actions/catalog.ts`
- [Operations actions](https://github.com/eric-moschen/clandestino-cardapio/blob/main/lib/actions/operations.ts): `lib/actions/operations.ts`
- **Supabase database and storage**
- [Server Supabase client](https://github.com/eric-moschen/clandestino-cardapio/blob/main/lib/supabase/server.ts): `lib/supabase/server.ts`
- [Service-role client](https://github.com/eric-moschen/clandestino-cardapio/blob/main/lib/supabase/service.ts): `lib/supabase/service.ts`

### Other components

- **Guest**
- **Administrator**

## Connections

- Guest → Home and table selection: opens (evidence: `app/page.tsx`)
- Home and table selection → Guest call controls: renders (evidence: `app/page.tsx`)
- Guest → Public menu route: opens (evidence: `README.md`)
- Public menu route → Menu and product details: renders (evidence: `app/cardapio/page.tsx`)
- Guest → Table request page: opens (evidence: `README.md`)
- Table request page → Table call button: renders (evidence: `app/mesa/page.tsx`)
- Guest call controls → Table call button: renders
- Table call button → Call registration and push: submits request
- Call registration and push → Supabase database and storage: records call (evidence: `app/api/calls/route.ts`)
- Call registration and push → Service-role client: loads push recipients (evidence: `app/api/calls/route.ts`)
- Call registration and push → Staff call board: notifies staff (evidence: `README.md`)
- Staff login → Staff authentication: uses sign-in (evidence: `app/garcom/login/page.tsx`)
- Staff authentication → Server Supabase client: authenticates (evidence: `lib/actions/staff-auth.ts`)
- Staff call board → Claim call endpoint: claims calls
- Staff call board → Complete call endpoint: completes calls
- Staff call board → Push subscription controls: pairs with (evidence: `app/garcom/page.tsx`)
- Push subscription controls → Subscribe endpoint: submits subscription
- Push subscription controls → Unsubscribe endpoint: removes subscription
- Subscribe endpoint → Supabase database and storage: saves subscription (evidence: `app/api/push/subscribe/route.ts`)
- Unsubscribe endpoint → Supabase database and storage: deactivates subscription (evidence: `app/api/push/unsubscribe/route.ts`)
- Push service worker → Guest: displays push
- Administrator → Admin login: signs in (evidence: `README.md`)
- Admin login → Server Supabase client: authenticates (evidence: `app/admin/login/page.tsx`)
- Admin authorization → Server Supabase client: checks membership (evidence: `lib/supabase/admin.ts`)
- Admin dashboard → Admin authorization: requires access (evidence: `README.md`)
- Catalog management → Catalog actions: invokes changes (evidence: `app/admin/(protected)/products/page.tsx`)
- Category management → Catalog actions: invokes changes (evidence: `app/admin/(protected)/categories/page.tsx`)
- Product editor → Catalog actions: submits product (evidence: `components/admin/product-form.tsx`)
- Product editor → Image upload: renders (evidence: `components/admin/product-form.tsx`)
- Product editor → Video upload: renders (evidence: `components/admin/product-form.tsx`)
- Catalog actions → Supabase database and storage: writes catalog (evidence: `README.md`)
- Image upload → Supabase database and storage: uploads image (evidence: `README.md`)
- Video upload → Supabase database and storage: uploads video (evidence: `README.md`)
- Table management → Operations actions: manages tables (evidence: `app/admin/(protected)/tables/page.tsx`)
- Staff management → Operations actions: manages staff (evidence: `app/admin/(protected)/staff/page.tsx`)
- Call history → Operations actions: manages calls (evidence: `app/admin/(protected)/calls/page.tsx`)
- Operations actions → Supabase database and storage: updates operations (evidence: `README.md`)
- Public menu route → Server Supabase client: loads menu data (evidence: `app/cardapio/page.tsx`)
- Home and table selection → Server Supabase client: loads active tables (evidence: `app/page.tsx`)
