# epk-courses/tablesync-pro architecture

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

- Interactive diagram: https://gitdiagram.com/epk-courses/tablesync-pro
- Repository: https://github.com/epk-courses/tablesync-pro

## Overview

TableSync Pro is a role-based restaurant management web application. Customers can browse the menu and manage reservations; waiters handle table occupancy, orders, kitchen-status progress, and invoices; managers oversee menu and table configuration, analytics, turnover estimates, and data exports/restores. The sampled PHP pages connect directly to a shared PDO database and use session-based role guards. Major documented capabilities are included, but several page implementations were not sampled, so their internal wiring is not inferred.

Main entry points: [`code/config/db.php`](https://github.com/epk-courses/tablesync-pro/blob/main/code/config/db.php) (PDO Database Access), [`code/pages/index.php`](https://github.com/epk-courses/tablesync-pro/blob/main/code/pages/index.php) (Landing Router), [`code/includes/auth.php`](https://github.com/epk-courses/tablesync-pro/blob/main/code/includes/auth.php) (Session & Role Guard), [`code/pages/dashboard_manager.php`](https://github.com/epk-courses/tablesync-pro/blob/main/code/pages/dashboard_manager.php) (Manager Portal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access &amp; Portals"]
  node_entry["Landing Router<br/>[index.php]"]
  node_login["Login<br/>[login.php]"]
  node_register["Registration<br/>[register.php]"]
  node_auth["Session &amp; Role Guard<br/>[auth.php]"]
  node_customer_portal["Customer Portal"]
end

subgraph group_dining["Dining Operations"]
  node_reservation["Reservations"]
  node_menu["Menu Browse &amp; Manage<br/>[menu_search.php]"]
  node_tables["Table Status &amp; Seating<br/>[tables_status.php]"]
  node_orders["Order Lifecycle<br/>[orders_active.php]"]
end

subgraph group_service["Service &amp; Billing"]
  node_waiter_portal["Waiter Floor Portal"]
  node_invoice["Invoice &amp; Payment<br/>[invoice_print.php]"]
end

subgraph group_management["Management &amp; Insights"]
  node_manager_portal["Manager Portal"]
  node_reports["Business Reports<br/>[reports.php]"]
  node_turnover["Turnover Analytics"]
  node_backup["Backup &amp; Restore<br/>[backup.php]"]
end

node_customer(("Customer"))
node_waiter(("Waiter"))
node_manager(("Manager"))
node_db_driver["PDO Database Access<br/>[db.php]"]
node_database[("Restaurant Data<br/>[schema.sql]")]

node_customer -->|"opens portal"| node_entry
node_waiter -->|"opens portal"| node_entry
node_manager -->|"opens portal"| node_entry
node_entry -->|"redirects unauthenticated"| node_login
node_entry -->|"routes by role"| node_customer_portal
node_login -->|"uses session guard"| node_auth
node_register -->|"uses session guard"| node_auth
node_customer_portal -->|"requires customer role"| node_auth
node_waiter_portal -->|"requires session"| node_auth
node_manager_portal -->|"requires manager role"| node_auth
node_customer_portal -->|"offers booking access"| node_reservation
node_customer_portal -->|"offers menu access"| node_menu
node_tables -->|"links active orders"| node_orders
node_waiter_portal -->|"opens floor controls"| node_tables
node_waiter_portal -->|"opens order tracking"| node_orders
node_orders -->|"links billing"| node_invoice
node_manager_portal -->|"opens analytics"| node_reports
node_manager_portal -->|"opens turnover view"| node_turnover
node_manager_portal -->|"opens data tools"| node_backup
node_menu -->|"queries menu data"| node_db_driver
node_tables -->|"queries seating data"| node_db_driver
node_invoice -->|"reads and updates invoices"| node_db_driver
node_reports -->|"queries business data"| node_db_driver
node_turnover -->|"queries dining history"| node_db_driver
node_backup -->|"exports and restores"| node_db_driver
node_db_driver -->|"reads and writes"| node_database

click node_entry "https://github.com/epk-courses/tablesync-pro/blob/main/code/pages/index.php"
click node_login "https://github.com/epk-courses/tablesync-pro/blob/main/code/pages/login.php"
click node_register "https://github.com/epk-courses/tablesync-pro/blob/main/code/pages/register.php"
click node_auth "https://github.com/epk-courses/tablesync-pro/blob/main/code/includes/auth.php"
click node_customer_portal "https://github.com/epk-courses/tablesync-pro/blob/main/code/pages/dashboard_customer.php"
click node_reservation "https://github.com/epk-courses/tablesync-pro/blob/main/code/pages/reservations_create.php"
click node_menu "https://github.com/epk-courses/tablesync-pro/blob/main/code/pages/menu_search.php"
click node_tables "https://github.com/epk-courses/tablesync-pro/blob/main/code/pages/tables_status.php"
click node_orders "https://github.com/epk-courses/tablesync-pro/blob/main/code/pages/orders_active.php"
click node_waiter_portal "https://github.com/epk-courses/tablesync-pro/blob/main/code/pages/dashboard_waiter.php"
click node_invoice "https://github.com/epk-courses/tablesync-pro/blob/main/code/includes/invoice_print.php"
click node_manager_portal "https://github.com/epk-courses/tablesync-pro/blob/main/code/pages/dashboard_manager.php"
click node_reports "https://github.com/epk-courses/tablesync-pro/blob/main/code/pages/reports.php"
click node_turnover "https://github.com/epk-courses/tablesync-pro/blob/main/code/includes/turnover_prediction.php"
click node_backup "https://github.com/epk-courses/tablesync-pro/blob/main/code/includes/backup.php"
click node_db_driver "https://github.com/epk-courses/tablesync-pro/blob/main/code/config/db.php"
click node_database "https://github.com/epk-courses/tablesync-pro/blob/main/backend/schema.sql"

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_entry,node_login,node_register,node_auth,node_customer_portal toneBlue
class node_reservation,node_menu,node_tables,node_orders,node_db_driver,node_database toneAmber
class node_waiter_portal,node_invoice toneMint
class node_manager_portal,node_reports,node_turnover,node_backup toneRose
class node_customer,node_waiter,node_manager toneIndigo
```

## Components

### Access & Portals

- [Landing Router](https://github.com/epk-courses/tablesync-pro/blob/main/code/pages/index.php): `code/pages/index.php`
- [Login](https://github.com/epk-courses/tablesync-pro/blob/main/code/pages/login.php): `code/pages/login.php`
- [Registration](https://github.com/epk-courses/tablesync-pro/blob/main/code/pages/register.php): `code/pages/register.php`
- [Session & Role Guard](https://github.com/epk-courses/tablesync-pro/blob/main/code/includes/auth.php): `code/includes/auth.php`
- [Customer Portal](https://github.com/epk-courses/tablesync-pro/blob/main/code/pages/dashboard_customer.php): `code/pages/dashboard_customer.php`

### Dining Operations

- [Reservations](https://github.com/epk-courses/tablesync-pro/blob/main/code/pages/reservations_create.php): `code/pages/reservations_create.php`
- [Menu Browse & Manage](https://github.com/epk-courses/tablesync-pro/blob/main/code/pages/menu_search.php): `code/pages/menu_search.php`
- [Table Status & Seating](https://github.com/epk-courses/tablesync-pro/blob/main/code/pages/tables_status.php): `code/pages/tables_status.php`
- [Order Lifecycle](https://github.com/epk-courses/tablesync-pro/blob/main/code/pages/orders_active.php): `code/pages/orders_active.php`

### Service & Billing

- [Waiter Floor Portal](https://github.com/epk-courses/tablesync-pro/blob/main/code/pages/dashboard_waiter.php): `code/pages/dashboard_waiter.php`
- [Invoice & Payment](https://github.com/epk-courses/tablesync-pro/blob/main/code/includes/invoice_print.php): `code/includes/invoice_print.php`

### Management & Insights

- [Manager Portal](https://github.com/epk-courses/tablesync-pro/blob/main/code/pages/dashboard_manager.php): `code/pages/dashboard_manager.php`
- [Business Reports](https://github.com/epk-courses/tablesync-pro/blob/main/code/pages/reports.php): `code/pages/reports.php`
- [Turnover Analytics](https://github.com/epk-courses/tablesync-pro/blob/main/code/includes/turnover_prediction.php): `code/includes/turnover_prediction.php`
- [Backup & Restore](https://github.com/epk-courses/tablesync-pro/blob/main/code/includes/backup.php): `code/includes/backup.php`

### Other components

- **Customer**
- **Waiter**
- **Manager**
- [PDO Database Access](https://github.com/epk-courses/tablesync-pro/blob/main/code/config/db.php): `code/config/db.php`
- [Restaurant Data](https://github.com/epk-courses/tablesync-pro/blob/main/backend/schema.sql): `backend/schema.sql`

## Connections

- Customer → Landing Router: opens portal
- Waiter → Landing Router: opens portal
- Manager → Landing Router: opens portal
- Landing Router → Login: redirects unauthenticated
- Landing Router → Customer Portal: routes by role
- Login → Session & Role Guard: uses session guard
- Registration → Session & Role Guard: uses session guard
- Customer Portal → Session & Role Guard: requires customer role
- Waiter Floor Portal → Session & Role Guard: requires session
- Manager Portal → Session & Role Guard: requires manager role
- Customer Portal → Reservations: offers booking access
- Customer Portal → Menu Browse & Manage: offers menu access
- Table Status & Seating → Order Lifecycle: links active orders
- Waiter Floor Portal → Table Status & Seating: opens floor controls
- Waiter Floor Portal → Order Lifecycle: opens order tracking
- Order Lifecycle → Invoice & Payment: links billing
- Manager Portal → Business Reports: opens analytics
- Manager Portal → Turnover Analytics: opens turnover view
- Manager Portal → Backup & Restore: opens data tools
- Menu Browse & Manage → PDO Database Access: queries menu data
- Table Status & Seating → PDO Database Access: queries seating data
- Invoice & Payment → PDO Database Access: reads and updates invoices
- Business Reports → PDO Database Access: queries business data
- Turnover Analytics → PDO Database Access: queries dining history
- Backup & Restore → PDO Database Access: exports and restores
- PDO Database Access → Restaurant Data: reads and writes
