# wiwer/lanchonete-app architecture

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

- Interactive diagram: https://gitdiagram.com/wiwer/lanchonete-app
- Repository: https://github.com/wiwer/lanchonete-app

## Overview

A Next.js point-of-sale and management system for a snack bar, covering dine-in service, delivery, menu administration, payments, sales analytics, and unified order history. The main workflow runs from staff opening a table or creating a delivery order, through item and status management, to payment or delivery completion; admins maintain the menu and review business results. UI-to-API links are included where excerpts show requests; the README documents broader capabilities. Database wiring and several route details were not sampled, so those links rely on documented behavior.

Main entry points: [`app/lib/apiClient.ts`](https://github.com/wiwer/lanchonete-app/blob/main/app/lib/apiClient.ts) (API Client), [`app/admin/cardapio/page.tsx`](https://github.com/wiwer/lanchonete-app/blob/main/app/admin/cardapio/page.tsx) (Product Management), [`app/historico/page.tsx`](https://github.com/wiwer/lanchonete-app/blob/main/app/historico/page.tsx) (Unified History), [`app/garcom/page.tsx`](https://github.com/wiwer/lanchonete-app/blob/main/app/garcom/page.tsx) (Table Overview)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_front["Staff Workflows"]
  node_tables["Table Overview<br/>[page.tsx]"]
  node_neworder["Open Table Order<br/>[page.tsx]"]
  node_orderdetail["Order Management<br/>[page.tsx]"]
  node_itemactions["Order Item Actions<br/>[AddItemButton.tsx]"]
  node_cashier["Payment Queue<br/>[page.tsx]"]
  node_paymentactions["Payment Actions"]
end

subgraph group_delivery["Delivery Operations"]
  node_deliverylist["Delivery Orders<br/>[page.tsx]"]
  node_deliverycreate["Create Delivery<br/>[page.tsx]"]
  node_deliverydetail["Delivery Details<br/>[page.tsx]"]
  node_deliveryedit["Edit Delivery<br/>[page.tsx]"]
end

subgraph group_admin["Administration"]
  node_menu["Public Menu<br/>[page.tsx]"]
  node_catalogadmin["Product Management<br/>[page.tsx]"]
  node_categoryadmin["Category Management<br/>[page.tsx]"]
  node_dashboard["Sales Dashboard<br/>[page.tsx]"]
  node_history["Unified History<br/>[page.tsx]"]
end

subgraph group_shared["API and Shared"]
  node_apiclient["API Client<br/>[apiClient.ts]"]
  node_catalogapi["Catalog API<br/>[route.ts]"]
  node_categoryapi["Category API<br/>[route.ts]"]
  node_orderapi["Dine-in Order API<br/>[route.ts]"]
  node_deliveryapi["Delivery API<br/>[route.ts]"]
  node_historyapi["History API<br/>[route.ts]"]
  node_dashboardapi["Dashboard API<br/>[route.ts]"]
  node_tablesapi["Tables API<br/>[route.ts]"]
end

node_staff(("Waitstaff"))
node_adminuser(("Administrator"))
node_database[("SQLite Database")]

node_staff -->|"uses"| node_tables
node_tables -->|"opens"| node_neworder
node_neworder -.->|"creates order"| node_orderapi
node_tables -->|"views order"| node_orderdetail
node_orderdetail -->|"renders actions"| node_itemactions
node_orderdetail -.->|"uses"| node_apiclient
node_itemactions -->|"requests changes"| node_apiclient
node_cashier -->|"renders actions"| node_paymentactions
node_paymentactions -->|"requests payment"| node_apiclient
node_staff -->|"manages delivery"| node_deliverylist
node_deliverylist -->|"starts order"| node_deliverycreate
node_deliverycreate -.->|"submits order"| node_apiclient
node_deliverylist -.->|"opens order"| node_deliverydetail
node_deliverydetail -->|"edits pending"| node_deliveryedit
node_adminuser -->|"maintains menu"| node_catalogadmin
node_adminuser -->|"organizes categories"| node_categoryadmin
node_adminuser -->|"reviews sales"| node_dashboard
node_adminuser -->|"reviews orders"| node_history
node_catalogadmin -->|"requests catalog"| node_apiclient
node_categoryadmin -->|"requests categories"| node_apiclient
node_history -->|"requests history"| node_apiclient
node_history -->|"fetches history"| node_historyapi
node_history -->|"fetches tables"| node_tablesapi
node_catalogadmin -->|"fetches products"| node_catalogapi
node_catalogadmin -->|"fetches categories"| node_categoryapi
node_categoryadmin -->|"fetches products"| node_catalogapi
node_catalogapi -.->|"reads and writes"| node_database
node_categoryapi -.->|"reads and writes"| node_database
node_orderapi -.->|"reads and writes"| node_database
node_deliveryapi -.->|"reads and writes"| node_database
node_historyapi -.->|"reads data"| node_database
node_dashboardapi -.->|"aggregates data"| node_database

click node_tables "https://github.com/wiwer/lanchonete-app/blob/main/app/garcom/page.tsx"
click node_neworder "https://github.com/wiwer/lanchonete-app/blob/main/app/garcom/pedido/novo/page.tsx"
click node_orderdetail "https://github.com/wiwer/lanchonete-app/blob/main/app/pedido/%5BorderId%5D/page.tsx"
click node_itemactions "https://github.com/wiwer/lanchonete-app/blob/main/app/pedido/%5BorderId%5D/components/AddItemButton.tsx"
click node_cashier "https://github.com/wiwer/lanchonete-app/blob/main/app/caixa/page.tsx"
click node_paymentactions "https://github.com/wiwer/lanchonete-app/blob/main/app/caixa/components/ConfirmarPagamentoButton.tsx"
click node_deliverylist "https://github.com/wiwer/lanchonete-app/blob/main/app/delivery/page.tsx"
click node_deliverycreate "https://github.com/wiwer/lanchonete-app/blob/main/app/delivery/novo/page.tsx"
click node_deliverydetail "https://github.com/wiwer/lanchonete-app/blob/main/app/delivery/%5Bid%5D/page.tsx"
click node_deliveryedit "https://github.com/wiwer/lanchonete-app/blob/main/app/delivery/%5Bid%5D/editar/page.tsx"
click node_menu "https://github.com/wiwer/lanchonete-app/blob/main/app/page.tsx"
click node_catalogadmin "https://github.com/wiwer/lanchonete-app/blob/main/app/admin/cardapio/page.tsx"
click node_categoryadmin "https://github.com/wiwer/lanchonete-app/blob/main/app/admin/categorias/page.tsx"
click node_dashboard "https://github.com/wiwer/lanchonete-app/blob/main/app/admin/dashboard/page.tsx"
click node_history "https://github.com/wiwer/lanchonete-app/blob/main/app/historico/page.tsx"
click node_apiclient "https://github.com/wiwer/lanchonete-app/blob/main/app/lib/apiClient.ts"
click node_catalogapi "https://github.com/wiwer/lanchonete-app/blob/main/app/api/products/route.ts"
click node_categoryapi "https://github.com/wiwer/lanchonete-app/blob/main/app/api/categories/route.ts"
click node_orderapi "https://github.com/wiwer/lanchonete-app/blob/main/app/api/orders/route.ts"
click node_deliveryapi "https://github.com/wiwer/lanchonete-app/blob/main/app/api/delivery/route.ts"
click node_historyapi "https://github.com/wiwer/lanchonete-app/blob/main/app/api/history/route.ts"
click node_dashboardapi "https://github.com/wiwer/lanchonete-app/blob/main/app/api/dashboard/route.ts"
click node_tablesapi "https://github.com/wiwer/lanchonete-app/blob/main/app/api/tables/route.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_tables,node_neworder,node_orderdetail,node_itemactions,node_cashier,node_paymentactions toneBlue
class node_deliverylist,node_deliverycreate,node_deliverydetail,node_deliveryedit,node_database toneAmber
class node_menu,node_catalogadmin,node_categoryadmin,node_dashboard,node_history toneMint
class node_apiclient,node_catalogapi,node_categoryapi,node_orderapi,node_deliveryapi,node_historyapi,node_dashboardapi,node_tablesapi toneRose
class node_staff,node_adminuser toneIndigo
```

## Components

### Staff Workflows

- [Table Overview](https://github.com/wiwer/lanchonete-app/blob/main/app/garcom/page.tsx): `app/garcom/page.tsx`
- [Open Table Order](https://github.com/wiwer/lanchonete-app/blob/main/app/garcom/pedido/novo/page.tsx): `app/garcom/pedido/novo/page.tsx`
- [Order Management](https://github.com/wiwer/lanchonete-app/blob/main/app/pedido/%5BorderId%5D/page.tsx): `app/pedido/[orderId]/page.tsx`
- [Order Item Actions](https://github.com/wiwer/lanchonete-app/blob/main/app/pedido/%5BorderId%5D/components/AddItemButton.tsx): `app/pedido/[orderId]/components/AddItemButton.tsx`
- [Payment Queue](https://github.com/wiwer/lanchonete-app/blob/main/app/caixa/page.tsx): `app/caixa/page.tsx`
- [Payment Actions](https://github.com/wiwer/lanchonete-app/blob/main/app/caixa/components/ConfirmarPagamentoButton.tsx): `app/caixa/components/ConfirmarPagamentoButton.tsx`

### Delivery Operations

- [Delivery Orders](https://github.com/wiwer/lanchonete-app/blob/main/app/delivery/page.tsx): `app/delivery/page.tsx`
- [Create Delivery](https://github.com/wiwer/lanchonete-app/blob/main/app/delivery/novo/page.tsx): `app/delivery/novo/page.tsx`
- [Delivery Details](https://github.com/wiwer/lanchonete-app/blob/main/app/delivery/%5Bid%5D/page.tsx): `app/delivery/[id]/page.tsx`
- [Edit Delivery](https://github.com/wiwer/lanchonete-app/blob/main/app/delivery/%5Bid%5D/editar/page.tsx): `app/delivery/[id]/editar/page.tsx`

### Administration

- [Public Menu](https://github.com/wiwer/lanchonete-app/blob/main/app/page.tsx): `app/page.tsx`
- [Product Management](https://github.com/wiwer/lanchonete-app/blob/main/app/admin/cardapio/page.tsx): `app/admin/cardapio/page.tsx`
- [Category Management](https://github.com/wiwer/lanchonete-app/blob/main/app/admin/categorias/page.tsx): `app/admin/categorias/page.tsx`
- [Sales Dashboard](https://github.com/wiwer/lanchonete-app/blob/main/app/admin/dashboard/page.tsx): `app/admin/dashboard/page.tsx`
- [Unified History](https://github.com/wiwer/lanchonete-app/blob/main/app/historico/page.tsx): `app/historico/page.tsx`

### API and Shared

- [API Client](https://github.com/wiwer/lanchonete-app/blob/main/app/lib/apiClient.ts): `app/lib/apiClient.ts`
- [Catalog API](https://github.com/wiwer/lanchonete-app/blob/main/app/api/products/route.ts): `app/api/products/route.ts`
- [Category API](https://github.com/wiwer/lanchonete-app/blob/main/app/api/categories/route.ts): `app/api/categories/route.ts`
- [Dine-in Order API](https://github.com/wiwer/lanchonete-app/blob/main/app/api/orders/route.ts): `app/api/orders/route.ts`
- [Delivery API](https://github.com/wiwer/lanchonete-app/blob/main/app/api/delivery/route.ts): `app/api/delivery/route.ts`
- [History API](https://github.com/wiwer/lanchonete-app/blob/main/app/api/history/route.ts): `app/api/history/route.ts`
- [Dashboard API](https://github.com/wiwer/lanchonete-app/blob/main/app/api/dashboard/route.ts): `app/api/dashboard/route.ts`
- [Tables API](https://github.com/wiwer/lanchonete-app/blob/main/app/api/tables/route.ts): `app/api/tables/route.ts`

### Other components

- **Waitstaff**
- **Administrator**
- **SQLite Database**

## Connections

- Waitstaff → Table Overview: uses (evidence: `README.md`)
- Table Overview → Open Table Order: opens (evidence: `app/garcom/page.tsx`)
- Open Table Order → Dine-in Order API: creates order
- Table Overview → Order Management: views order (evidence: `app/garcom/page.tsx`)
- Order Management → Order Item Actions: renders actions (evidence: `app/pedido/[orderId]/page.tsx`)
- Order Management → API Client: uses
- Order Item Actions → API Client: requests changes (evidence: `app/pedido/[orderId]/components/AddItemButton.tsx`)
- Payment Queue → Payment Actions: renders actions (evidence: `app/caixa/page.tsx`)
- Payment Actions → API Client: requests payment (evidence: `app/caixa/components/ConfirmarPagamentoButton.tsx`)
- Waitstaff → Delivery Orders: manages delivery (evidence: `README.md`)
- Delivery Orders → Create Delivery: starts order (evidence: `app/delivery/page.tsx`)
- Create Delivery → API Client: submits order (evidence: `app/delivery/novo/page.tsx`)
- Delivery Orders → Delivery Details: opens order
- Delivery Details → Edit Delivery: edits pending (evidence: `README.md`)
- Administrator → Product Management: maintains menu (evidence: `README.md`)
- Administrator → Category Management: organizes categories (evidence: `README.md`)
- Administrator → Sales Dashboard: reviews sales (evidence: `README.md`)
- Administrator → Unified History: reviews orders (evidence: `README.md`)
- Product Management → API Client: requests catalog (evidence: `app/admin/cardapio/page.tsx`)
- Category Management → API Client: requests categories (evidence: `app/admin/categorias/page.tsx`)
- Unified History → API Client: requests history (evidence: `app/historico/page.tsx`)
- Unified History → History API: fetches history (evidence: `app/historico/page.tsx`)
- Unified History → Tables API: fetches tables (evidence: `app/historico/page.tsx`)
- Product Management → Catalog API: fetches products (evidence: `app/admin/cardapio/page.tsx`)
- Product Management → Category API: fetches categories (evidence: `app/admin/cardapio/page.tsx`)
- Category Management → Catalog API: fetches products (evidence: `app/admin/categorias/page.tsx`)
- Catalog API → SQLite Database: reads and writes
- Category API → SQLite Database: reads and writes
- Dine-in Order API → SQLite Database: reads and writes
- Delivery API → SQLite Database: reads and writes
- History API → SQLite Database: reads data
- Dashboard API → SQLite Database: aggregates data
