# maadhavagarwal/restuarat_mad_project architecture

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

- Interactive diagram: https://gitdiagram.com/maadhavagarwal/restuarat_mad_project
- Repository: https://github.com/maadhavagarwal/restuarat_mad_project

## Overview

This repository contains three restaurant-management implementations: a Kotlin desktop/web POS and REST service, an Android client for that service, and a Next.js restaurant-operations app with customer, staff, booking, and account areas. The clearest end-to-end workflow is cashier menu selection and checkout, followed by kitchen-ticket and table updates. Other documented-by-tree capabilities include analytics, customer lookup, authentication, reservations, receipts, and browser-to-Supabase synchronization. Some routes and screens are unsampled, so their internal wiring is not inferred.

Main entry points: [`kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/controller/ApiController.kt`](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/controller/ApiController.kt) (Restaurant REST API), [`kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/repository/RestaurantRepository.kt`](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/repository/RestaurantRepository.kt) (Restaurant Operations), [`os/src/lib/dbClient.ts`](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/lib/dbClient.ts) (Account and Booking Data), [`kotlin-restaurant-mobile/app/src/main/java/com/restaurant/mobile/MainActivity.kt`](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-mobile/app/src/main/java/com/restaurant/mobile/MainActivity.kt) (Mobile POS UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_android["Android Client"]
  node_mobileui["Mobile POS UI<br/>[MainActivity.kt]"]
  node_mobileapi["REST API Client<br/>[ApiClient.kt]"]
  node_mobilemodels["Mobile Models<br/>[Models.kt]"]
end

subgraph group_spring["Kotlin Restaurant OS"]
  node_springapi["Restaurant REST API<br/>[ApiController.kt]"]
  node_springrepo[("Restaurant Operations")]
  node_springmodels["Restaurant Models<br/>[Models.kt]"]
  node_webui["POS and KDS UI<br/>[app.js]"]
  node_menu["Menu Catalog<br/>[ApiController.kt]"]
  node_checkout["Order Checkout<br/>[ApiController.kt]"]
  node_kitchen["Kitchen Tickets<br/>[ApiController.kt]"]
  node_tables["Table Management<br/>[ApiController.kt]"]
  node_customers["Customer Lookup<br/>[ApiController.kt]"]
  node_analytics["Sales Analytics<br/>[ApiController.kt]"]
end

subgraph group_next["Next.js Operations"]
  node_nextcustomer["Customer Portal<br/>[page.tsx]"]
  node_profile["Customer Profile<br/>[page.tsx]"]
  node_reservations["Reservations<br/>[page.tsx]"]
  node_kitchenpage["Kitchen Screen<br/>[page.tsx]"]
  node_tablespage["Tables Screen<br/>[page.tsx]"]
  node_auth["Account Auth<br/>[route.ts]"]
  node_login["Login Route<br/>[route.ts]"]
  node_bookingroute["Booking Route<br/>[route.ts]"]
  node_receipt["Receipt Route<br/>[route.ts]"]
end

subgraph group_data["Persistence and Sync"]
  node_dbclient[("Account and Booking Data<br/>[dbClient.ts]")]
  node_browserdb[("Offline Local Store<br/>[db.ts]")]
  node_sync["Background Sync<br/>[syncService.ts]"]
end

node_cashier(("Cashier"))
node_supabase[("Supabase<br/>[supabaseClient.ts]")]
node_guest(("Restaurant Guest"))

node_cashier -->|"uses"| node_mobileui
node_mobileui -->|"requests data"| node_mobileapi
node_mobileapi -->|"calls REST"| node_springapi
node_mobileui -->|"renders"| node_mobilemodels
node_webui -->|"fetches API"| node_springapi
node_springapi -->|"invokes"| node_springrepo
node_springapi -->|"uses models"| node_springmodels
node_mobileapi -->|"exchanges JSON"| node_springmodels
node_springapi -->|"serves menu"| node_menu
node_springapi -->|"submits orders"| node_checkout
node_springapi -->|"serves tickets"| node_kitchen
node_springapi -->|"serves tables"| node_tables
node_springapi -->|"serves customers"| node_customers
node_springapi -->|"serves metrics"| node_analytics
node_checkout -->|"creates order"| node_springrepo
node_springrepo -->|"creates KOT"| node_kitchen
node_springrepo -->|"updates occupancy"| node_tables
node_springrepo -->|"updates loyalty"| node_customers
node_guest -->|"uses portal"| node_nextcustomer
node_guest -->|"requests booking"| node_reservations
node_auth -->|"queries and saves"| node_dbclient
node_login -->|"finds account"| node_dbclient
node_bookingroute -->|"saves booking"| node_dbclient
node_receipt -->|"returns receipt status"| node_guest
node_sync -->|"reads and updates"| node_browserdb
node_sync -->|"upserts records"| node_supabase
node_dbclient -->|"queries and inserts"| node_supabase

click node_mobileui "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-mobile/app/src/main/java/com/restaurant/mobile/MainActivity.kt"
click node_mobileapi "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-mobile/app/src/main/java/com/restaurant/mobile/api/ApiClient.kt"
click node_mobilemodels "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-mobile/app/src/main/java/com/restaurant/mobile/model/Models.kt"
click node_springapi "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/controller/ApiController.kt"
click node_springrepo "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/repository/RestaurantRepository.kt"
click node_springmodels "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/model/Models.kt"
click node_webui "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-os/src/main/resources/static/app.js"
click node_menu "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/controller/ApiController.kt"
click node_checkout "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/controller/ApiController.kt"
click node_kitchen "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/controller/ApiController.kt"
click node_tables "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/controller/ApiController.kt"
click node_customers "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/controller/ApiController.kt"
click node_analytics "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/controller/ApiController.kt"
click node_nextcustomer "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/app/customer/page.tsx"
click node_profile "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/app/customer/profile/page.tsx"
click node_reservations "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/app/customer/reservations/page.tsx"
click node_kitchenpage "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/app/kitchen/page.tsx"
click node_tablespage "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/app/tables/page.tsx"
click node_auth "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/app/api/auth/register/route.ts"
click node_login "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/app/api/auth/login/route.ts"
click node_bookingroute "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/app/api/email/booking/route.ts"
click node_receipt "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/app/api/email/receipt/route.ts"
click node_dbclient "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/lib/dbClient.ts"
click node_browserdb "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/db/db.ts"
click node_sync "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/db/syncService.ts"
click node_supabase "https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/lib/supabaseClient.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_mobileui,node_mobileapi,node_mobilemodels toneBlue
class node_springapi,node_springrepo,node_springmodels,node_webui,node_menu,node_checkout,node_kitchen,node_tables,node_customers,node_analytics,node_supabase toneAmber
class node_nextcustomer,node_profile,node_reservations,node_kitchenpage,node_tablespage,node_auth,node_login,node_bookingroute,node_receipt toneMint
class node_dbclient,node_browserdb,node_sync toneRose
class node_cashier,node_guest toneIndigo
```

## Components

### Android Client

- [Mobile POS UI](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-mobile/app/src/main/java/com/restaurant/mobile/MainActivity.kt): `kotlin-restaurant-mobile/app/src/main/java/com/restaurant/mobile/MainActivity.kt`
- [REST API Client](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-mobile/app/src/main/java/com/restaurant/mobile/api/ApiClient.kt): `kotlin-restaurant-mobile/app/src/main/java/com/restaurant/mobile/api/ApiClient.kt`
- [Mobile Models](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-mobile/app/src/main/java/com/restaurant/mobile/model/Models.kt): `kotlin-restaurant-mobile/app/src/main/java/com/restaurant/mobile/model/Models.kt`

### Kotlin Restaurant OS

- [Restaurant REST API](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/controller/ApiController.kt): `kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/controller/ApiController.kt`
- [Restaurant Operations](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/repository/RestaurantRepository.kt): `kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/repository/RestaurantRepository.kt`
- [Restaurant Models](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/model/Models.kt): `kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/model/Models.kt`
- [POS and KDS UI](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-os/src/main/resources/static/app.js): `kotlin-restaurant-os/src/main/resources/static/app.js`
- [Menu Catalog](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/controller/ApiController.kt): `kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/controller/ApiController.kt`
- [Order Checkout](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/controller/ApiController.kt): `kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/controller/ApiController.kt`
- [Kitchen Tickets](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/controller/ApiController.kt): `kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/controller/ApiController.kt`
- [Table Management](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/controller/ApiController.kt): `kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/controller/ApiController.kt`
- [Customer Lookup](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/controller/ApiController.kt): `kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/controller/ApiController.kt`
- [Sales Analytics](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/controller/ApiController.kt): `kotlin-restaurant-os/src/main/kotlin/com/restaurant/restaurant_os/controller/ApiController.kt`

### Next.js Operations

- [Customer Portal](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/app/customer/page.tsx): `os/src/app/customer/page.tsx`
- [Customer Profile](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/app/customer/profile/page.tsx): `os/src/app/customer/profile/page.tsx`
- [Reservations](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/app/customer/reservations/page.tsx): `os/src/app/customer/reservations/page.tsx`
- [Kitchen Screen](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/app/kitchen/page.tsx): `os/src/app/kitchen/page.tsx`
- [Tables Screen](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/app/tables/page.tsx): `os/src/app/tables/page.tsx`
- [Account Auth](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/app/api/auth/register/route.ts): `os/src/app/api/auth/register/route.ts`
- [Login Route](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/app/api/auth/login/route.ts): `os/src/app/api/auth/login/route.ts`
- [Booking Route](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/app/api/email/booking/route.ts): `os/src/app/api/email/booking/route.ts`
- [Receipt Route](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/app/api/email/receipt/route.ts): `os/src/app/api/email/receipt/route.ts`

### Persistence and Sync

- [Account and Booking Data](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/lib/dbClient.ts): `os/src/lib/dbClient.ts`
- [Offline Local Store](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/db/db.ts): `os/src/db/db.ts`
- [Background Sync](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/db/syncService.ts): `os/src/db/syncService.ts`

### Other components

- **Cashier**
- [Supabase](https://github.com/maadhavagarwal/restuarat_mad_project/blob/main/os/src/lib/supabaseClient.ts): `os/src/lib/supabaseClient.ts`
- **Restaurant Guest**

## Connections

- Cashier → Mobile POS UI: uses
- Mobile POS UI → REST API Client: requests data
- REST API Client → Restaurant REST API: calls REST
- Mobile POS UI → Mobile Models: renders
- POS and KDS UI → Restaurant REST API: fetches API
- Restaurant REST API → Restaurant Operations: invokes
- Restaurant REST API → Restaurant Models: uses models
- REST API Client → Restaurant Models: exchanges JSON
- Restaurant REST API → Menu Catalog: serves menu
- Restaurant REST API → Order Checkout: submits orders
- Restaurant REST API → Kitchen Tickets: serves tickets
- Restaurant REST API → Table Management: serves tables
- Restaurant REST API → Customer Lookup: serves customers
- Restaurant REST API → Sales Analytics: serves metrics
- Order Checkout → Restaurant Operations: creates order
- Restaurant Operations → Kitchen Tickets: creates KOT
- Restaurant Operations → Table Management: updates occupancy
- Restaurant Operations → Customer Lookup: updates loyalty
- Restaurant Guest → Customer Portal: uses portal
- Restaurant Guest → Reservations: requests booking
- Account Auth → Account and Booking Data: queries and saves
- Login Route → Account and Booking Data: finds account
- Booking Route → Account and Booking Data: saves booking
- Receipt Route → Restaurant Guest: returns receipt status
- Background Sync → Offline Local Store: reads and updates
- Background Sync → Supabase: upserts records
- Account and Booking Data → Supabase: queries and inserts
