# t0ff1xs/teambog architecture

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

- Interactive diagram: https://gitdiagram.com/t0ff1xs/teambog
- Repository: https://github.com/t0ff1xs/teambog

## Overview

Lanay is a restaurant operations and ordering system with PHP APIs backed by MariaDB and browser-based staff and customer screens. Staff sign in, create table orders or receive customer QR orders, and send them into kitchen status handling; waiters mark ready orders served, after which cashiers record payment. Owners manage menus, staff, stock, recipes, and table QR codes. The graph includes documented but prototype-only screens as screens, not as connected backend workflows. Source excerpts show backend calls and persistence; screen-to-API links follow README documentation.

Main entry points: [`api/bootstrap.php`](https://github.com/t0ff1xs/teambog/blob/main/api/bootstrap.php) (API foundation), [`screens`](https://github.com/t0ff1xs/teambog/tree/main/screens) (Staff work screens), [`api/orders.php`](https://github.com/t0ff1xs/teambog/blob/main/api/orders.php) (Order API), [`screens/owner`](https://github.com/t0ff1xs/teambog/tree/main/screens/owner) (Owner screens)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_screens["Restaurant screens"]
  node_signin["Staff sign-in<br/>[roles.html]"]
  node_staffscreens["Staff work screens"]
  node_customerscreens["Customer screens"]
  node_ownerscreens["Owner screens"]
end

subgraph group_orders["Ordering and service"]
  node_ordersapi["Order API<br/>[orders.php]"]
  node_statusapi["Order status API<br/>[status.php]"]
  node_customerorder["Customer order API<br/>[customer-order.php]"]
  node_tracking["Order tracking API"]
  node_payments["Payments API<br/>[payments.php]"]
end

subgraph group_management["Management APIs"]
  node_menuapi["Menu API<br/>[menu.php]"]
  node_menudata["Menu data<br/>[menu_data.php]"]
  node_inventory["Inventory API<br/>[inventory.php]"]
  node_inventoryhelpers["Inventory quantities"]
  node_staffapi["Staff API<br/>[staff.php]"]
  node_tablesapi["Tables API<br/>[tables.php]"]
  node_qr["Table QR API<br/>[table-qr.php]"]
end

subgraph group_shared["Shared backend"]
  node_login["Login API<br/>[login.php]"]
  node_session["Session API<br/>[session.php]"]
  node_bootstrap["API foundation<br/>[bootstrap.php]"]
end

node_staff(("Staff"))
node_customer(("Customer"))
node_mariadb[("MariaDB")]

node_staff -->|"signs in"| node_signin
node_signin -->|"submits PIN"| node_login
node_login -->|"uses"| node_bootstrap
node_staff -->|"uses"| node_staffscreens
node_staffscreens -->|"creates orders"| node_ordersapi
node_staffscreens -->|"updates status"| node_statusapi
node_staffscreens -->|"records payment"| node_payments
node_customer -->|"orders"| node_customerscreens
node_customerscreens -->|"loads menu"| node_customerorder
node_customerscreens -->|"submits order"| node_ordersapi
node_customerscreens -->|"tracks order"| node_tracking
node_ordersapi -->|"converts quantities"| node_inventoryhelpers
node_inventory -->|"uses"| node_inventoryhelpers
node_customerorder -->|"loads menu"| node_menudata
node_menuapi -->|"loads menu"| node_menudata
node_ownerscreens -->|"manages menu"| node_menuapi
node_ownerscreens -->|"manages stock"| node_inventory
node_ownerscreens -->|"manages staff"| node_staffapi
node_ownerscreens -->|"manages QR codes"| node_qr
node_staffscreens -->|"reads tables"| node_tablesapi
node_session -->|"uses"| node_bootstrap
node_ordersapi -->|"uses"| node_bootstrap
node_statusapi -->|"uses"| node_bootstrap
node_payments -->|"uses"| node_bootstrap
node_inventory -->|"uses"| node_bootstrap
node_staffapi -->|"uses"| node_bootstrap
node_tablesapi -->|"uses"| node_bootstrap
node_qr -->|"uses"| node_bootstrap
node_bootstrap -->|"connects to"| node_mariadb
node_ordersapi -->|"reads and writes"| node_mariadb
node_statusapi -->|"updates orders"| node_mariadb
node_inventory -->|"reads and writes"| node_mariadb
node_menudata -->|"reads menu"| node_mariadb
node_payments -->|"records payments"| node_mariadb

click node_signin "https://github.com/t0ff1xs/teambog/blob/main/screens/sign-in/roles.html"
click node_staffscreens "https://github.com/t0ff1xs/teambog/tree/main/screens"
click node_customerscreens "https://github.com/t0ff1xs/teambog/tree/main/screens/customer"
click node_ownerscreens "https://github.com/t0ff1xs/teambog/tree/main/screens/owner"
click node_login "https://github.com/t0ff1xs/teambog/blob/main/api/auth/login.php"
click node_session "https://github.com/t0ff1xs/teambog/blob/main/api/auth/session.php"
click node_ordersapi "https://github.com/t0ff1xs/teambog/blob/main/api/orders.php"
click node_statusapi "https://github.com/t0ff1xs/teambog/blob/main/api/orders/status.php"
click node_customerorder "https://github.com/t0ff1xs/teambog/blob/main/api/customer-order.php"
click node_tracking "https://github.com/t0ff1xs/teambog/blob/main/api/customer-order-status.php"
click node_payments "https://github.com/t0ff1xs/teambog/blob/main/api/payments.php"
click node_menuapi "https://github.com/t0ff1xs/teambog/blob/main/api/menu.php"
click node_menudata "https://github.com/t0ff1xs/teambog/blob/main/api/menu_data.php"
click node_inventory "https://github.com/t0ff1xs/teambog/blob/main/api/inventory.php"
click node_inventoryhelpers "https://github.com/t0ff1xs/teambog/blob/main/api/inventory_helpers.php"
click node_staffapi "https://github.com/t0ff1xs/teambog/blob/main/api/staff.php"
click node_tablesapi "https://github.com/t0ff1xs/teambog/blob/main/api/tables.php"
click node_qr "https://github.com/t0ff1xs/teambog/blob/main/api/table-qr.php"
click node_bootstrap "https://github.com/t0ff1xs/teambog/blob/main/api/bootstrap.php"

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_signin,node_staffscreens,node_customerscreens,node_ownerscreens toneBlue
class node_ordersapi,node_statusapi,node_customerorder,node_tracking,node_payments,node_mariadb toneAmber
class node_menuapi,node_menudata,node_inventory,node_inventoryhelpers,node_staffapi,node_tablesapi,node_qr toneMint
class node_login,node_session,node_bootstrap toneRose
class node_staff,node_customer toneIndigo
```

## Components

### Restaurant screens

- [Staff sign-in](https://github.com/t0ff1xs/teambog/blob/main/screens/sign-in/roles.html): `screens/sign-in/roles.html`
- [Staff work screens](https://github.com/t0ff1xs/teambog/tree/main/screens): `screens`
- [Customer screens](https://github.com/t0ff1xs/teambog/tree/main/screens/customer): `screens/customer`
- [Owner screens](https://github.com/t0ff1xs/teambog/tree/main/screens/owner): `screens/owner`

### Ordering and service

- [Order API](https://github.com/t0ff1xs/teambog/blob/main/api/orders.php): `api/orders.php`
- [Order status API](https://github.com/t0ff1xs/teambog/blob/main/api/orders/status.php): `api/orders/status.php`
- [Customer order API](https://github.com/t0ff1xs/teambog/blob/main/api/customer-order.php): `api/customer-order.php`
- [Order tracking API](https://github.com/t0ff1xs/teambog/blob/main/api/customer-order-status.php): `api/customer-order-status.php`
- [Payments API](https://github.com/t0ff1xs/teambog/blob/main/api/payments.php): `api/payments.php`

### Management APIs

- [Menu API](https://github.com/t0ff1xs/teambog/blob/main/api/menu.php): `api/menu.php`
- [Menu data](https://github.com/t0ff1xs/teambog/blob/main/api/menu_data.php): `api/menu_data.php`
- [Inventory API](https://github.com/t0ff1xs/teambog/blob/main/api/inventory.php): `api/inventory.php`
- [Inventory quantities](https://github.com/t0ff1xs/teambog/blob/main/api/inventory_helpers.php): `api/inventory_helpers.php`
- [Staff API](https://github.com/t0ff1xs/teambog/blob/main/api/staff.php): `api/staff.php`
- [Tables API](https://github.com/t0ff1xs/teambog/blob/main/api/tables.php): `api/tables.php`
- [Table QR API](https://github.com/t0ff1xs/teambog/blob/main/api/table-qr.php): `api/table-qr.php`

### Shared backend

- [Login API](https://github.com/t0ff1xs/teambog/blob/main/api/auth/login.php): `api/auth/login.php`
- [Session API](https://github.com/t0ff1xs/teambog/blob/main/api/auth/session.php): `api/auth/session.php`
- [API foundation](https://github.com/t0ff1xs/teambog/blob/main/api/bootstrap.php): `api/bootstrap.php`

### Other components

- **Staff**
- **Customer**
- **MariaDB**

## Connections

- Staff → Staff sign-in: signs in (evidence: `README.md`)
- Staff sign-in → Login API: submits PIN (evidence: `README.md`)
- Login API → API foundation: uses (evidence: `api/auth/login.php`)
- Staff → Staff work screens: uses (evidence: `README.md`)
- Staff work screens → Order API: creates orders (evidence: `README.md`)
- Staff work screens → Order status API: updates status (evidence: `README.md`)
- Staff work screens → Payments API: records payment (evidence: `README.md`)
- Customer → Customer screens: orders (evidence: `README.md`)
- Customer screens → Customer order API: loads menu (evidence: `README.md`)
- Customer screens → Order API: submits order (evidence: `README.md`)
- Customer screens → Order tracking API: tracks order (evidence: `README.md`)
- Order API → Inventory quantities: converts quantities (evidence: `api/orders.php`)
- Inventory API → Inventory quantities: uses (evidence: `api/inventory.php`)
- Customer order API → Menu data: loads menu (evidence: `api/customer-order.php`)
- Menu API → Menu data: loads menu (evidence: `api/menu.php`)
- Owner screens → Menu API: manages menu (evidence: `README.md`)
- Owner screens → Inventory API: manages stock (evidence: `README.md`)
- Owner screens → Staff API: manages staff (evidence: `README.md`)
- Owner screens → Table QR API: manages QR codes (evidence: `README.md`)
- Staff work screens → Tables API: reads tables (evidence: `README.md`)
- Session API → API foundation: uses (evidence: `api/auth/session.php`)
- Order API → API foundation: uses (evidence: `api/orders.php`)
- Order status API → API foundation: uses (evidence: `api/orders/status.php`)
- Payments API → API foundation: uses (evidence: `api/payments.php`)
- Inventory API → API foundation: uses (evidence: `api/inventory.php`)
- Staff API → API foundation: uses (evidence: `api/staff.php`)
- Tables API → API foundation: uses (evidence: `api/tables.php`)
- Table QR API → API foundation: uses (evidence: `api/table-qr.php`)
- API foundation → MariaDB: connects to (evidence: `api/bootstrap.php`)
- Order API → MariaDB: reads and writes (evidence: `api/orders.php`)
- Order status API → MariaDB: updates orders (evidence: `api/orders/status.php`)
- Inventory API → MariaDB: reads and writes (evidence: `api/inventory.php`)
- Menu data → MariaDB: reads menu (evidence: `api/menu_data.php`)
- Payments API → MariaDB: records payments (evidence: `api/payments.php`)
