# dushansenura/smartdine architecture

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

- Interactive diagram: https://gitdiagram.com/dushansenura/smartdine
- Repository: https://github.com/dushansenura/smartdine

## Overview

SmartDine is a restaurant operations system for managing branches, staff, dining spaces, bookings, menus, orders, kitchen service, and cashier payments. Staff use the React dashboard to select operational pages; page actions flow through shared API helpers to Express routes, which authorize requests and invoke the restaurant store. The store provides in-memory or PostgreSQL-backed persistence. The excerpts show selected route and frontend call paths, but not every page callback or route implementation, so some capability links are documented only by module references and are omitted where their caller is not visible.

Main entry points: [`Frontend/src/App.tsx`](https://github.com/dushansenura/smartdine/blob/main/Frontend/src/App.tsx) (Dashboard shell), [`Frontend/src/api.ts`](https://github.com/dushansenura/smartdine/blob/main/Frontend/src/api.ts) (API client), [`Backend/src/routes/api.routes.js`](https://github.com/dushansenura/smartdine/blob/main/Backend/src/routes/api.routes.js) (API routes), [`Backend/src/lib/restaurantStore.js`](https://github.com/dushansenura/smartdine/blob/main/Backend/src/lib/restaurantStore.js) (Restaurant store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Restaurant dashboard"]
  node_app_shell["Dashboard shell<br/>[App.tsx]"]
  node_booking_ui["Bookings<br/>[BookingPage.tsx]"]
  node_branch_ui["Branches<br/>[BranchPage.tsx]"]
  node_cashier_ui["Cashier<br/>[ChashiarPage.tsx]"]
  node_company_ui["Company settings"]
  node_dashboard_ui["Overview<br/>[DashboardPage.tsx]"]
  node_food_ui["Food ordering"]
  node_kitchen_ui["Kitchen<br/>[KitchenPage.tsx]"]
  node_menu_ui["Menu<br/>[MenuPage.tsx]"]
  node_order_ui["Orders<br/>[OrderPage.tsx]"]
  node_personal_ui["Personal settings"]
  node_staff_ui["Staff<br/>[StaffPage.tsx]"]
  node_spaces_ui["Tables and rooms<br/>[TableRoomsPage.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_api["HTTP service"]
  node_express_app["HTTP application<br/>[app.js]"]
  node_api_routes["API routes<br/>[api.routes.js]"]
  node_health_routes["Health route<br/>[health.routes.js]"]
  node_auth["Auth middleware<br/>[auth.js]"]
end

subgraph group_operations["Restaurant operations"]
  node_operations["Restaurant records<br/>[restaurantStore.js]"]
end

subgraph group_persistence["Persistence"]
  node_store["Restaurant store<br/>[restaurantStore.js]"]
  node_postgres[("PostgreSQL")]
  node_memory[("Memory state<br/>[restaurantStore.js]")]
end

node_staff_actor(("Restaurant staff"))

node_staff_actor -->|"uses"| node_app_shell
node_app_shell -->|"renders"| node_booking_ui
node_app_shell -->|"renders"| node_branch_ui
node_app_shell -->|"renders"| node_cashier_ui
node_app_shell -->|"renders"| node_company_ui
node_app_shell -->|"renders"| node_dashboard_ui
node_app_shell -->|"renders"| node_food_ui
node_app_shell -->|"renders"| node_kitchen_ui
node_app_shell -->|"renders"| node_menu_ui
node_app_shell -->|"renders"| node_order_ui
node_app_shell -->|"renders"| node_personal_ui
node_app_shell -->|"renders"| node_staff_ui
node_app_shell -->|"renders"| node_spaces_ui
node_app_shell -->|"calls"| node_api_client
node_booking_ui -->|"uses"| node_api_client
node_branch_ui -->|"uses"| node_api_client
node_cashier_ui -.->|"uses"| node_api_client
node_company_ui -.->|"uses"| node_api_client
node_dashboard_ui -.->|"uses"| node_api_client
node_food_ui -.->|"uses"| node_api_client
node_kitchen_ui -.->|"uses"| node_api_client
node_menu_ui -.->|"uses"| node_api_client
node_order_ui -.->|"uses"| node_api_client
node_personal_ui -.->|"uses"| node_api_client
node_staff_ui -->|"uses"| node_api_client
node_spaces_ui -->|"uses"| node_api_client
node_api_client -.->|"HTTP requests"| node_api_routes
node_express_app -->|"mounts"| node_api_routes
node_express_app -->|"mounts"| node_health_routes
node_api_routes -->|"guards routes"| node_auth
node_api_routes -->|"calls"| node_store
node_store -.->|"queries"| node_postgres
node_store -->|"uses"| node_memory

click node_app_shell "https://github.com/dushansenura/smartdine/blob/main/Frontend/src/App.tsx"
click node_booking_ui "https://github.com/dushansenura/smartdine/blob/main/Frontend/src/pages/Booking/BookingPage.tsx"
click node_branch_ui "https://github.com/dushansenura/smartdine/blob/main/Frontend/src/pages/Branch/BranchPage.tsx"
click node_cashier_ui "https://github.com/dushansenura/smartdine/blob/main/Frontend/src/pages/Cashier/ChashiarPage.tsx"
click node_company_ui "https://github.com/dushansenura/smartdine/blob/main/Frontend/src/pages/CompanySettings/CompanySettingsPage.tsx"
click node_dashboard_ui "https://github.com/dushansenura/smartdine/blob/main/Frontend/src/pages/Dashboard/DashboardPage.tsx"
click node_food_ui "https://github.com/dushansenura/smartdine/blob/main/Frontend/src/pages/FoodServiceOrder/FoodServiceOrderPage.tsx"
click node_kitchen_ui "https://github.com/dushansenura/smartdine/blob/main/Frontend/src/pages/Kitchen/KitchenPage.tsx"
click node_menu_ui "https://github.com/dushansenura/smartdine/blob/main/Frontend/src/pages/Menu/MenuPage.tsx"
click node_order_ui "https://github.com/dushansenura/smartdine/blob/main/Frontend/src/pages/Order/OrderPage.tsx"
click node_personal_ui "https://github.com/dushansenura/smartdine/blob/main/Frontend/src/pages/PersonalSettings/PersonalSettingsPage.tsx"
click node_staff_ui "https://github.com/dushansenura/smartdine/blob/main/Frontend/src/pages/Staff/StaffPage.tsx"
click node_spaces_ui "https://github.com/dushansenura/smartdine/blob/main/Frontend/src/pages/TableRooms/TableRoomsPage.tsx"
click node_api_client "https://github.com/dushansenura/smartdine/blob/main/Frontend/src/api.ts"
click node_express_app "https://github.com/dushansenura/smartdine/blob/main/Backend/src/app.js"
click node_api_routes "https://github.com/dushansenura/smartdine/blob/main/Backend/src/routes/api.routes.js"
click node_health_routes "https://github.com/dushansenura/smartdine/blob/main/Backend/src/routes/health.routes.js"
click node_auth "https://github.com/dushansenura/smartdine/blob/main/Backend/src/middleware/auth.js"
click node_store "https://github.com/dushansenura/smartdine/blob/main/Backend/src/lib/restaurantStore.js"
click node_memory "https://github.com/dushansenura/smartdine/blob/main/Backend/src/lib/restaurantStore.js"
click node_operations "https://github.com/dushansenura/smartdine/blob/main/Backend/src/lib/restaurantStore.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_app_shell,node_booking_ui,node_branch_ui,node_cashier_ui,node_company_ui,node_dashboard_ui,node_food_ui,node_kitchen_ui,node_menu_ui,node_order_ui,node_personal_ui,node_staff_ui,node_spaces_ui,node_api_client toneBlue
class node_express_app,node_api_routes,node_health_routes,node_auth toneAmber
class node_operations toneMint
class node_store,node_postgres,node_memory toneRose
class node_staff_actor toneIndigo
```

## Components

### Restaurant dashboard

- [Dashboard shell](https://github.com/dushansenura/smartdine/blob/main/Frontend/src/App.tsx): `Frontend/src/App.tsx`
- [Bookings](https://github.com/dushansenura/smartdine/blob/main/Frontend/src/pages/Booking/BookingPage.tsx): `Frontend/src/pages/Booking/BookingPage.tsx`
- [Branches](https://github.com/dushansenura/smartdine/blob/main/Frontend/src/pages/Branch/BranchPage.tsx): `Frontend/src/pages/Branch/BranchPage.tsx`
- [Cashier](https://github.com/dushansenura/smartdine/blob/main/Frontend/src/pages/Cashier/ChashiarPage.tsx): `Frontend/src/pages/Cashier/ChashiarPage.tsx`
- [Company settings](https://github.com/dushansenura/smartdine/blob/main/Frontend/src/pages/CompanySettings/CompanySettingsPage.tsx): `Frontend/src/pages/CompanySettings/CompanySettingsPage.tsx`
- [Overview](https://github.com/dushansenura/smartdine/blob/main/Frontend/src/pages/Dashboard/DashboardPage.tsx): `Frontend/src/pages/Dashboard/DashboardPage.tsx`
- [Food ordering](https://github.com/dushansenura/smartdine/blob/main/Frontend/src/pages/FoodServiceOrder/FoodServiceOrderPage.tsx): `Frontend/src/pages/FoodServiceOrder/FoodServiceOrderPage.tsx`
- [Kitchen](https://github.com/dushansenura/smartdine/blob/main/Frontend/src/pages/Kitchen/KitchenPage.tsx): `Frontend/src/pages/Kitchen/KitchenPage.tsx`
- [Menu](https://github.com/dushansenura/smartdine/blob/main/Frontend/src/pages/Menu/MenuPage.tsx): `Frontend/src/pages/Menu/MenuPage.tsx`
- [Orders](https://github.com/dushansenura/smartdine/blob/main/Frontend/src/pages/Order/OrderPage.tsx): `Frontend/src/pages/Order/OrderPage.tsx`
- [Personal settings](https://github.com/dushansenura/smartdine/blob/main/Frontend/src/pages/PersonalSettings/PersonalSettingsPage.tsx): `Frontend/src/pages/PersonalSettings/PersonalSettingsPage.tsx`
- [Staff](https://github.com/dushansenura/smartdine/blob/main/Frontend/src/pages/Staff/StaffPage.tsx): `Frontend/src/pages/Staff/StaffPage.tsx`
- [Tables and rooms](https://github.com/dushansenura/smartdine/blob/main/Frontend/src/pages/TableRooms/TableRoomsPage.tsx): `Frontend/src/pages/TableRooms/TableRoomsPage.tsx`
- [API client](https://github.com/dushansenura/smartdine/blob/main/Frontend/src/api.ts): `Frontend/src/api.ts`

### HTTP service

- [HTTP application](https://github.com/dushansenura/smartdine/blob/main/Backend/src/app.js): `Backend/src/app.js`
- [API routes](https://github.com/dushansenura/smartdine/blob/main/Backend/src/routes/api.routes.js): `Backend/src/routes/api.routes.js`
- [Health route](https://github.com/dushansenura/smartdine/blob/main/Backend/src/routes/health.routes.js): `Backend/src/routes/health.routes.js`
- [Auth middleware](https://github.com/dushansenura/smartdine/blob/main/Backend/src/middleware/auth.js): `Backend/src/middleware/auth.js`

### Restaurant operations

- [Restaurant records](https://github.com/dushansenura/smartdine/blob/main/Backend/src/lib/restaurantStore.js): `Backend/src/lib/restaurantStore.js`

### Persistence

- [Restaurant store](https://github.com/dushansenura/smartdine/blob/main/Backend/src/lib/restaurantStore.js): `Backend/src/lib/restaurantStore.js`
- **PostgreSQL**
- [Memory state](https://github.com/dushansenura/smartdine/blob/main/Backend/src/lib/restaurantStore.js): `Backend/src/lib/restaurantStore.js`

### Other components

- **Restaurant staff**

## Connections

- Restaurant staff → Dashboard shell: uses
- Dashboard shell → Bookings: renders (evidence: `Frontend/src/App.tsx`)
- Dashboard shell → Branches: renders (evidence: `Frontend/src/App.tsx`)
- Dashboard shell → Cashier: renders (evidence: `Frontend/src/App.tsx`)
- Dashboard shell → Company settings: renders (evidence: `Frontend/src/App.tsx`)
- Dashboard shell → Overview: renders (evidence: `Frontend/src/App.tsx`)
- Dashboard shell → Food ordering: renders (evidence: `Frontend/src/App.tsx`)
- Dashboard shell → Kitchen: renders (evidence: `Frontend/src/App.tsx`)
- Dashboard shell → Menu: renders (evidence: `Frontend/src/App.tsx`)
- Dashboard shell → Orders: renders (evidence: `Frontend/src/App.tsx`)
- Dashboard shell → Personal settings: renders (evidence: `Frontend/src/App.tsx`)
- Dashboard shell → Staff: renders (evidence: `Frontend/src/App.tsx`)
- Dashboard shell → Tables and rooms: renders (evidence: `Frontend/src/App.tsx`)
- Dashboard shell → API client: calls (evidence: `Frontend/src/App.tsx`)
- Bookings → API client: uses (evidence: `Frontend/src/pages/Booking/BookingPage.tsx`)
- Branches → API client: uses (evidence: `Frontend/src/pages/Branch/BranchPage.tsx`)
- Cashier → API client: uses (evidence: `Frontend/src/pages/Cashier/ChashiarPage.tsx`)
- Company settings → API client: uses (evidence: `Frontend/src/pages/CompanySettings/CompanySettingsPage.tsx`)
- Overview → API client: uses (evidence: `Frontend/src/pages/Dashboard/DashboardPage.tsx`)
- Food ordering → API client: uses (evidence: `Frontend/src/pages/FoodServiceOrder/FoodServiceOrderPage.tsx`)
- Kitchen → API client: uses (evidence: `Frontend/src/pages/Kitchen/KitchenPage.tsx`)
- Menu → API client: uses (evidence: `Frontend/src/pages/Menu/MenuPage.tsx`)
- Orders → API client: uses (evidence: `Frontend/src/pages/Order/OrderPage.tsx`)
- Personal settings → API client: uses (evidence: `Frontend/src/pages/PersonalSettings/PersonalSettingsPage.tsx`)
- Staff → API client: uses (evidence: `Frontend/src/pages/Staff/StaffPage.tsx`)
- Tables and rooms → API client: uses (evidence: `Frontend/src/pages/TableRooms/TableRoomsPage.tsx`)
- API client → API routes: HTTP requests
- HTTP application → API routes: mounts (evidence: `Backend/src/app.js`)
- HTTP application → Health route: mounts (evidence: `Backend/src/app.js`)
- API routes → Auth middleware: guards routes (evidence: `Backend/src/routes/api.routes.js`)
- API routes → Restaurant store: calls (evidence: `Backend/src/routes/api.routes.js`)
- Restaurant store → PostgreSQL: queries
- Restaurant store → Memory state: uses (evidence: `Backend/src/lib/restaurantStore.js`)
