# lekhactung/restaurant-management architecture

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

- Interactive diagram: https://gitdiagram.com/lekhactung/restaurant-management
- Repository: https://github.com/lekhactung/restaurant-management

## Overview

This is a multilingual restaurant website with public information and service-request flows, plus branch-scoped administration. Customers browse menus and promotions, submit bookings or feedback, and can ask independent questions through a source-grounded RAG chat. Administrators authenticate to manage bookings, feedback, reports, booking hours, and promotions. The graph preserves these distinct workflows and the documented Supabase and Gemini integrations. Some route and action implementations were not sampled, so their links rely on README statements; unsampled internal call paths are not inferred.

Main entry points: [`lib/rag.ts`](https://github.com/lekhactung/restaurant-management/blob/main/lib/rag.ts) (RAG retrieval), [`app/(public)/menu/page.tsx`](https://github.com/lekhactung/restaurant-management/blob/main/app/(public)/menu/page.tsx) (Menu page), [`components/booking/BookingForm.tsx`](https://github.com/lekhactung/restaurant-management/blob/main/components/booking/BookingForm.tsx) (Booking form), [`app/admin/page.tsx`](https://github.com/lekhactung/restaurant-management/blob/main/app/admin/page.tsx) (Booking dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public experience"]
  node_public_pages["Public pages<br/>[page.tsx]"]
  node_menu_page["Menu page<br/>[page.tsx]"]
  node_menu_data["Menu data<br/>[menu.ts]"]
  node_menu_viewer["Menu viewer<br/>[MenuViewer.tsx]"]
  node_promotions_page["Promotions page<br/>[page.tsx]"]
  node_promotion_board["Promotion board<br/>[PromotionBoard.tsx]"]
end

subgraph group_service["Customer services"]
  node_booking_form["Booking form<br/>[BookingForm.tsx]"]
  node_booking_action["Booking action<br/>[actions.ts]"]
  node_booking_rules["Booking rules<br/>[booking.ts]"]
  node_feedback_form["Feedback form<br/>[FeedbackForm.tsx]"]
  node_feedback_action["Feedback action<br/>[actions.ts]"]
  node_promotion_rules["Promotion logic<br/>[promotions.ts]"]
end

subgraph group_admin["Branch administration"]
  node_admin_login["Admin login<br/>[AdminLogin.tsx]"]
  node_admin_access["Access control"]
  node_admin_actions["Booking actions<br/>[actions.ts]"]
  node_admin_booking["Booking dashboard<br/>[page.tsx]"]
  node_feedback_admin["Feedback management<br/>[page.tsx]"]
  node_reports["Reports<br/>[page.tsx]"]
  node_settings["Booking settings<br/>[page.tsx]"]
  node_promotion_admin["Promotion management<br/>[page.tsx]"]
  node_promotion_form["Promotion editor<br/>[PromotionForm.tsx]"]
end

subgraph group_knowledge["RAG knowledge"]
  node_chat_ui["Customer chat<br/>[CustomerChat.tsx]"]
  node_chat_action["Chat action<br/>[chat-actions.ts]"]
  node_rag_retrieval["RAG retrieval<br/>[rag.ts]"]
  node_rag_data["Confirmed knowledge<br/>[rag-knowledge.ts]"]
  node_rag_menu["RAG menu data<br/>[rag-menu.ts]"]
  node_rag_tanbinh["Tân Bình menu data"]
  node_rag_questions["Suggested questions<br/>[rag-questions.ts]"]
  node_search_text["Vietnamese search"]
  node_rag_language["RAG language<br/>[rag-language.ts]"]
end

subgraph group_shared["Shared platform"]
end

node_customer(("Customer"))
node_gemini{{"Gemini API"}}
node_admin(("Administrator"))
node_database[("Supabase")]

node_customer -->|"browses"| node_public_pages
node_customer -->|"selects menu"| node_menu_page
node_menu_page -->|"renders"| node_menu_viewer
node_menu_page -->|"loads"| node_menu_data
node_menu_viewer -->|"displays"| node_menu_data
node_customer -->|"requests booking"| node_booking_form
node_booking_form -->|"submits"| node_booking_action
node_booking_form -->|"uses rules"| node_booking_rules
node_customer -->|"sends feedback"| node_feedback_form
node_feedback_form -->|"submits"| node_feedback_action
node_customer -->|"views offers"| node_promotions_page
node_promotions_page -->|"renders"| node_promotion_board
node_promotion_board -->|"uses"| node_promotion_rules
node_customer -->|"asks question"| node_chat_ui
node_chat_ui -->|"sends question"| node_chat_action
node_chat_action -->|"retrieves sources"| node_rag_retrieval
node_rag_retrieval -->|"searches"| node_rag_data
node_rag_retrieval -->|"searches"| node_rag_menu
node_rag_retrieval -->|"searches"| node_rag_tanbinh
node_rag_retrieval -->|"uses questions"| node_rag_questions
node_rag_retrieval -->|"normalizes queries"| node_search_text
node_rag_retrieval -->|"detects language"| node_rag_language
node_chat_action -->|"generates answer"| node_gemini
node_admin -->|"signs in"| node_admin_login
node_admin_login -->|"calls sign-in"| node_admin_actions
node_admin_actions -->|"checks access"| node_admin_access
node_admin -->|"manages bookings"| node_admin_booking
node_admin_booking -->|"checks access"| node_admin_access
node_admin_booking -->|"reads dashboard"| node_database
node_admin -->|"manages feedback"| node_feedback_admin
node_feedback_admin -->|"reads tickets"| node_database
node_admin -->|"views reports"| node_reports
node_reports -->|"loads reports"| node_database
node_admin -->|"sets booking hours"| node_settings
node_settings -->|"loads settings"| node_database
node_admin -->|"manages offers"| node_promotion_admin
node_promotion_admin -->|"renders editor"| node_promotion_form
node_promotion_form -->|"uses"| node_promotion_rules
node_promotion_admin -->|"uses promotion store"| node_database
node_booking_action -.->|"stores request"| node_database
node_feedback_action -.->|"stores feedback"| node_database

click node_public_pages "https://github.com/lekhactung/restaurant-management/blob/main/app/(public)/page.tsx"
click node_menu_page "https://github.com/lekhactung/restaurant-management/blob/main/app/(public)/menu/page.tsx"
click node_menu_data "https://github.com/lekhactung/restaurant-management/blob/main/data/menu.ts"
click node_menu_viewer "https://github.com/lekhactung/restaurant-management/blob/main/components/menu/MenuViewer.tsx"
click node_booking_form "https://github.com/lekhactung/restaurant-management/blob/main/components/booking/BookingForm.tsx"
click node_booking_action "https://github.com/lekhactung/restaurant-management/blob/main/app/(public)/booking/actions.ts"
click node_booking_rules "https://github.com/lekhactung/restaurant-management/blob/main/lib/booking.ts"
click node_feedback_form "https://github.com/lekhactung/restaurant-management/blob/main/components/feedback/FeedbackForm.tsx"
click node_feedback_action "https://github.com/lekhactung/restaurant-management/blob/main/app/(public)/feedback/actions.ts"
click node_promotions_page "https://github.com/lekhactung/restaurant-management/blob/main/app/(public)/promotions/page.tsx"
click node_promotion_board "https://github.com/lekhactung/restaurant-management/blob/main/components/promotions/PromotionBoard.tsx"
click node_promotion_rules "https://github.com/lekhactung/restaurant-management/blob/main/lib/promotions.ts"
click node_chat_ui "https://github.com/lekhactung/restaurant-management/blob/main/components/chat/CustomerChat.tsx"
click node_chat_action "https://github.com/lekhactung/restaurant-management/blob/main/app/(public)/chat-actions.ts"
click node_rag_retrieval "https://github.com/lekhactung/restaurant-management/blob/main/lib/rag.ts"
click node_rag_data "https://github.com/lekhactung/restaurant-management/blob/main/data/rag-knowledge.ts"
click node_rag_menu "https://github.com/lekhactung/restaurant-management/blob/main/data/rag-menu.ts"
click node_rag_tanbinh "https://github.com/lekhactung/restaurant-management/blob/main/data/rag-menu-tan-binh.ts"
click node_rag_questions "https://github.com/lekhactung/restaurant-management/blob/main/data/rag-questions.ts"
click node_search_text "https://github.com/lekhactung/restaurant-management/blob/main/lib/vietnamese-search.ts"
click node_rag_language "https://github.com/lekhactung/restaurant-management/blob/main/lib/rag-language.ts"
click node_admin_login "https://github.com/lekhactung/restaurant-management/blob/main/components/booking/AdminLogin.tsx"
click node_admin_access "https://github.com/lekhactung/restaurant-management/blob/main/lib/admin-action-access.ts"
click node_admin_actions "https://github.com/lekhactung/restaurant-management/blob/main/app/admin/actions.ts"
click node_admin_booking "https://github.com/lekhactung/restaurant-management/blob/main/app/admin/page.tsx"
click node_feedback_admin "https://github.com/lekhactung/restaurant-management/blob/main/app/admin/feedback/page.tsx"
click node_reports "https://github.com/lekhactung/restaurant-management/blob/main/app/admin/reports/page.tsx"
click node_settings "https://github.com/lekhactung/restaurant-management/blob/main/app/admin/settings/page.tsx"
click node_promotion_admin "https://github.com/lekhactung/restaurant-management/blob/main/app/admin/promotions/page.tsx"
click node_promotion_form "https://github.com/lekhactung/restaurant-management/blob/main/components/promotions/PromotionForm.tsx"

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_public_pages,node_menu_page,node_menu_data,node_menu_viewer,node_promotions_page,node_promotion_board toneBlue
class node_booking_form,node_booking_action,node_booking_rules,node_feedback_form,node_feedback_action,node_promotion_rules,node_database toneAmber
class node_admin_login,node_admin_access,node_admin_actions,node_admin_booking,node_feedback_admin,node_reports,node_settings,node_promotion_admin,node_promotion_form,node_gemini toneMint
class node_chat_ui,node_chat_action,node_rag_retrieval,node_rag_data,node_rag_menu,node_rag_tanbinh,node_rag_questions,node_search_text,node_rag_language toneRose
class node_customer,node_admin toneIndigo
```

## Components

### Public experience

- [Public pages](https://github.com/lekhactung/restaurant-management/blob/main/app/(public)/page.tsx): `app/(public)/page.tsx`
- [Menu page](https://github.com/lekhactung/restaurant-management/blob/main/app/(public)/menu/page.tsx): `app/(public)/menu/page.tsx`
- [Menu data](https://github.com/lekhactung/restaurant-management/blob/main/data/menu.ts): `data/menu.ts`
- [Menu viewer](https://github.com/lekhactung/restaurant-management/blob/main/components/menu/MenuViewer.tsx): `components/menu/MenuViewer.tsx`
- [Promotions page](https://github.com/lekhactung/restaurant-management/blob/main/app/(public)/promotions/page.tsx): `app/(public)/promotions/page.tsx`
- [Promotion board](https://github.com/lekhactung/restaurant-management/blob/main/components/promotions/PromotionBoard.tsx): `components/promotions/PromotionBoard.tsx`

### Customer services

- [Booking form](https://github.com/lekhactung/restaurant-management/blob/main/components/booking/BookingForm.tsx): `components/booking/BookingForm.tsx`
- [Booking action](https://github.com/lekhactung/restaurant-management/blob/main/app/(public)/booking/actions.ts): `app/(public)/booking/actions.ts`
- [Booking rules](https://github.com/lekhactung/restaurant-management/blob/main/lib/booking.ts): `lib/booking.ts`
- [Feedback form](https://github.com/lekhactung/restaurant-management/blob/main/components/feedback/FeedbackForm.tsx): `components/feedback/FeedbackForm.tsx`
- [Feedback action](https://github.com/lekhactung/restaurant-management/blob/main/app/(public)/feedback/actions.ts): `app/(public)/feedback/actions.ts`
- [Promotion logic](https://github.com/lekhactung/restaurant-management/blob/main/lib/promotions.ts): `lib/promotions.ts`

### Branch administration

- [Admin login](https://github.com/lekhactung/restaurant-management/blob/main/components/booking/AdminLogin.tsx): `components/booking/AdminLogin.tsx`
- [Access control](https://github.com/lekhactung/restaurant-management/blob/main/lib/admin-action-access.ts): `lib/admin-action-access.ts`
- [Booking actions](https://github.com/lekhactung/restaurant-management/blob/main/app/admin/actions.ts): `app/admin/actions.ts`
- [Booking dashboard](https://github.com/lekhactung/restaurant-management/blob/main/app/admin/page.tsx): `app/admin/page.tsx`
- [Feedback management](https://github.com/lekhactung/restaurant-management/blob/main/app/admin/feedback/page.tsx): `app/admin/feedback/page.tsx`
- [Reports](https://github.com/lekhactung/restaurant-management/blob/main/app/admin/reports/page.tsx): `app/admin/reports/page.tsx`
- [Booking settings](https://github.com/lekhactung/restaurant-management/blob/main/app/admin/settings/page.tsx): `app/admin/settings/page.tsx`
- [Promotion management](https://github.com/lekhactung/restaurant-management/blob/main/app/admin/promotions/page.tsx): `app/admin/promotions/page.tsx`
- [Promotion editor](https://github.com/lekhactung/restaurant-management/blob/main/components/promotions/PromotionForm.tsx): `components/promotions/PromotionForm.tsx`

### RAG knowledge

- [Customer chat](https://github.com/lekhactung/restaurant-management/blob/main/components/chat/CustomerChat.tsx): `components/chat/CustomerChat.tsx`
- [Chat action](https://github.com/lekhactung/restaurant-management/blob/main/app/(public)/chat-actions.ts): `app/(public)/chat-actions.ts`
- [RAG retrieval](https://github.com/lekhactung/restaurant-management/blob/main/lib/rag.ts): `lib/rag.ts`
- [Confirmed knowledge](https://github.com/lekhactung/restaurant-management/blob/main/data/rag-knowledge.ts): `data/rag-knowledge.ts`
- [RAG menu data](https://github.com/lekhactung/restaurant-management/blob/main/data/rag-menu.ts): `data/rag-menu.ts`
- [Tân Bình menu data](https://github.com/lekhactung/restaurant-management/blob/main/data/rag-menu-tan-binh.ts): `data/rag-menu-tan-binh.ts`
- [Suggested questions](https://github.com/lekhactung/restaurant-management/blob/main/data/rag-questions.ts): `data/rag-questions.ts`
- [Vietnamese search](https://github.com/lekhactung/restaurant-management/blob/main/lib/vietnamese-search.ts): `lib/vietnamese-search.ts`
- [RAG language](https://github.com/lekhactung/restaurant-management/blob/main/lib/rag-language.ts): `lib/rag-language.ts`

### Other components

- **Customer**
- **Gemini API**
- **Administrator**
- **Supabase**

## Connections

- Customer → Public pages: browses
- Customer → Menu page: selects menu
- Menu page → Menu viewer: renders (evidence: `app/(public)/menu/page.tsx`)
- Menu page → Menu data: loads (evidence: `app/(public)/menu/page.tsx`)
- Menu viewer → Menu data: displays (evidence: `components/menu/MenuViewer.tsx`)
- Customer → Booking form: requests booking
- Booking form → Booking action: submits (evidence: `components/booking/BookingForm.tsx`)
- Booking form → Booking rules: uses rules (evidence: `components/booking/BookingForm.tsx`)
- Customer → Feedback form: sends feedback
- Feedback form → Feedback action: submits (evidence: `components/feedback/FeedbackForm.tsx`)
- Customer → Promotions page: views offers
- Promotions page → Promotion board: renders (evidence: `app/(public)/promotions/page.tsx`)
- Promotion board → Promotion logic: uses
- Customer → Customer chat: asks question
- Customer chat → Chat action: sends question
- Chat action → RAG retrieval: retrieves sources
- RAG retrieval → Confirmed knowledge: searches (evidence: `lib/rag.ts`)
- RAG retrieval → RAG menu data: searches (evidence: `lib/rag.ts`)
- RAG retrieval → Tân Bình menu data: searches (evidence: `lib/rag.ts`)
- RAG retrieval → Suggested questions: uses questions (evidence: `lib/rag.ts`)
- RAG retrieval → Vietnamese search: normalizes queries (evidence: `lib/rag.ts`)
- RAG retrieval → RAG language: detects language (evidence: `lib/rag.ts`)
- Chat action → Gemini API: generates answer
- Administrator → Admin login: signs in
- Admin login → Booking actions: calls sign-in (evidence: `components/booking/AdminLogin.tsx`)
- Booking actions → Access control: checks access (evidence: `app/admin/actions.ts`)
- Administrator → Booking dashboard: manages bookings
- Booking dashboard → Access control: checks access (evidence: `app/admin/page.tsx`)
- Booking dashboard → Supabase: reads dashboard (evidence: `app/admin/page.tsx`)
- Administrator → Feedback management: manages feedback
- Feedback management → Supabase: reads tickets (evidence: `app/admin/feedback/page.tsx`)
- Administrator → Reports: views reports
- Reports → Supabase: loads reports (evidence: `app/admin/reports/page.tsx`)
- Administrator → Booking settings: sets booking hours
- Booking settings → Supabase: loads settings (evidence: `app/admin/settings/page.tsx`)
- Administrator → Promotion management: manages offers
- Promotion management → Promotion editor: renders editor (evidence: `app/admin/promotions/page.tsx`)
- Promotion editor → Promotion logic: uses (evidence: `components/promotions/PromotionForm.tsx`)
- Promotion management → Supabase: uses promotion store (evidence: `app/admin/promotions/page.tsx`)
- Booking action → Supabase: stores request
- Feedback action → Supabase: stores feedback
