# nirmal-001/urban-cafe architecture

> Architecture diagram of the GitHub repository nirmal-001/urban-cafe, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nirmal-001/urban-cafe
- Repository: https://github.com/nirmal-001/urban-cafe

## Overview

Urban Brew is a café ordering application with customer-facing table-based ordering and an admin area for managing the menu, categories, and tables. Customers view available items, build a session cart, and submit an order; administrators manage catalog and table data and can generate table QR codes. The graph reflects sampled code and SOURCE INDEX references; the README is empty, and several endpoints are unsampled, so their internal behavior and some navigation links are not inferred.

Main entry points: [`db.php`](https://github.com/nirmal-001/urban-cafe/blob/main/db.php) (Application database), [`customer/cart.php`](https://github.com/nirmal-001/urban-cafe/blob/main/customer/cart.php) (Session cart), [`admin/tables.php`](https://github.com/nirmal-001/urban-cafe/blob/main/admin/tables.php) (Table management), [`customer/menu.php`](https://github.com/nirmal-001/urban-cafe/blob/main/customer/menu.php) (Browse menu)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer ordering"]
  node_menu["Browse menu<br/>[menu.php]"]
  node_cart["Session cart<br/>[cart.php]"]
  node_cart_updates["Cart updates<br/>[update_cart.php]"]
  node_checkout["Place order<br/>[checkout.php]"]
  node_success["Order confirmation<br/>[success.php]"]
end

subgraph group_admin["Café administration"]
  node_admin_dashboard["Admin dashboard<br/>[dashboard.php]"]
  node_menu_management["Menu management<br/>[menu_items.php]"]
  node_menu_item_edit["Add menu item<br/>[add_item.php]"]
  node_category_management["Category management<br/>[category.php]"]
  node_category_add["Add category<br/>[add_categories.php]"]
  node_table_management["Table management<br/>[tables.php]"]
  node_table_add["Add table<br/>[add_table.php]"]
end

subgraph group_identity["Account access"]
  node_register["Register account"]
  node_login["Sign in<br/>[login.php]"]
  node_dashboard["User dashboard<br/>[dashboard.php]"]
end

subgraph group_qr["QR generation"]
  node_qr_generate["Table QR generation<br/>[GenerateQR.php]"]
  node_qr_encoder["QR encoder<br/>[qrlib.php]"]
end

node_diner(("Diner"))
node_admin_user(("Administrator"))
node_database[("Application database<br/>[db.php]")]

node_diner -->|"browses"| node_menu
node_menu -->|"queries items"| node_database
node_menu -->|"opens cart"| node_cart
node_cart -->|"reads items"| node_database
node_cart -->|"requests updates"| node_cart_updates
node_cart -->|"continues ordering"| node_checkout
node_checkout -->|"stores order"| node_database
node_checkout -->|"redirects to"| node_success
node_admin_user -.->|"manages café"| node_admin_dashboard
node_menu_management -->|"queries menu"| node_database
node_menu_management -->|"links to add"| node_menu_item_edit
node_menu_item_edit -->|"reads categories; saves item"| node_database
node_category_management -->|"queries categories"| node_database
node_category_management -->|"links to add"| node_category_add
node_category_add -->|"writes category"| node_database
node_table_management -->|"queries tables"| node_database
node_table_management -->|"links to add"| node_table_add
node_table_add -->|"writes table"| node_database
node_table_management -->|"requests QR"| node_qr_generate
node_qr_generate -->|"encodes table URL"| node_qr_encoder
node_qr_generate -->|"saves QR path"| node_database
node_register -->|"checks and creates user"| node_database
node_login -->|"checks credentials"| node_database
node_login -->|"redirects on success"| node_dashboard

click node_menu "https://github.com/nirmal-001/urban-cafe/blob/main/customer/menu.php"
click node_cart "https://github.com/nirmal-001/urban-cafe/blob/main/customer/cart.php"
click node_cart_updates "https://github.com/nirmal-001/urban-cafe/blob/main/customer/update_cart.php"
click node_checkout "https://github.com/nirmal-001/urban-cafe/blob/main/customer/checkout.php"
click node_success "https://github.com/nirmal-001/urban-cafe/blob/main/customer/success.php"
click node_admin_dashboard "https://github.com/nirmal-001/urban-cafe/blob/main/admin/dashboard.php"
click node_menu_management "https://github.com/nirmal-001/urban-cafe/blob/main/admin/menu_items.php"
click node_menu_item_edit "https://github.com/nirmal-001/urban-cafe/blob/main/admin/add_item.php"
click node_category_management "https://github.com/nirmal-001/urban-cafe/blob/main/admin/category.php"
click node_category_add "https://github.com/nirmal-001/urban-cafe/blob/main/admin/add_categories.php"
click node_table_management "https://github.com/nirmal-001/urban-cafe/blob/main/admin/tables.php"
click node_table_add "https://github.com/nirmal-001/urban-cafe/blob/main/admin/add_table.php"
click node_qr_generate "https://github.com/nirmal-001/urban-cafe/blob/main/admin/GenerateQR.php"
click node_qr_encoder "https://github.com/nirmal-001/urban-cafe/blob/main/phpqrcode/qrlib.php"
click node_register "https://github.com/nirmal-001/urban-cafe/blob/main/process_register.php"
click node_login "https://github.com/nirmal-001/urban-cafe/blob/main/login.php"
click node_dashboard "https://github.com/nirmal-001/urban-cafe/blob/main/dashboard.php"
click node_database "https://github.com/nirmal-001/urban-cafe/blob/main/db.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_menu,node_cart,node_cart_updates,node_checkout,node_success toneBlue
class node_admin_dashboard,node_menu_management,node_menu_item_edit,node_category_management,node_category_add,node_table_management,node_table_add,node_database toneAmber
class node_register,node_login,node_dashboard toneMint
class node_qr_generate,node_qr_encoder toneRose
class node_diner,node_admin_user toneIndigo
```

## Components

### Customer ordering

- [Browse menu](https://github.com/nirmal-001/urban-cafe/blob/main/customer/menu.php): `customer/menu.php`
- [Session cart](https://github.com/nirmal-001/urban-cafe/blob/main/customer/cart.php): `customer/cart.php`
- [Cart updates](https://github.com/nirmal-001/urban-cafe/blob/main/customer/update_cart.php): `customer/update_cart.php`
- [Place order](https://github.com/nirmal-001/urban-cafe/blob/main/customer/checkout.php): `customer/checkout.php`
- [Order confirmation](https://github.com/nirmal-001/urban-cafe/blob/main/customer/success.php): `customer/success.php`

### Café administration

- [Admin dashboard](https://github.com/nirmal-001/urban-cafe/blob/main/admin/dashboard.php): `admin/dashboard.php`
- [Menu management](https://github.com/nirmal-001/urban-cafe/blob/main/admin/menu_items.php): `admin/menu_items.php`
- [Add menu item](https://github.com/nirmal-001/urban-cafe/blob/main/admin/add_item.php): `admin/add_item.php`
- [Category management](https://github.com/nirmal-001/urban-cafe/blob/main/admin/category.php): `admin/category.php`
- [Add category](https://github.com/nirmal-001/urban-cafe/blob/main/admin/add_categories.php): `admin/add_categories.php`
- [Table management](https://github.com/nirmal-001/urban-cafe/blob/main/admin/tables.php): `admin/tables.php`
- [Add table](https://github.com/nirmal-001/urban-cafe/blob/main/admin/add_table.php): `admin/add_table.php`

### Account access

- [Register account](https://github.com/nirmal-001/urban-cafe/blob/main/process_register.php): `process_register.php`
- [Sign in](https://github.com/nirmal-001/urban-cafe/blob/main/login.php): `login.php`
- [User dashboard](https://github.com/nirmal-001/urban-cafe/blob/main/dashboard.php): `dashboard.php`

### QR generation

- [Table QR generation](https://github.com/nirmal-001/urban-cafe/blob/main/admin/GenerateQR.php): `admin/GenerateQR.php`
- [QR encoder](https://github.com/nirmal-001/urban-cafe/blob/main/phpqrcode/qrlib.php): `phpqrcode/qrlib.php`

### Other components

- **Diner**
- **Administrator**
- [Application database](https://github.com/nirmal-001/urban-cafe/blob/main/db.php): `db.php`

## Connections

- Diner → Browse menu: browses
- Browse menu → Application database: queries items (evidence: `customer/menu.php`)
- Browse menu → Session cart: opens cart (evidence: `customer/menu.php`)
- Session cart → Application database: reads items (evidence: `customer/cart.php`)
- Session cart → Cart updates: requests updates (evidence: `customer/cart.php`)
- Session cart → Place order: continues ordering (evidence: `customer/cart.php`)
- Place order → Application database: stores order (evidence: `customer/checkout.php`)
- Place order → Order confirmation: redirects to (evidence: `customer/checkout.php`)
- Administrator → Admin dashboard: manages café
- Menu management → Application database: queries menu (evidence: `admin/menu_items.php`)
- Menu management → Add menu item: links to add (evidence: `admin/menu_items.php`)
- Add menu item → Application database: reads categories; saves item (evidence: `admin/add_item.php`)
- Category management → Application database: queries categories (evidence: `admin/category.php`)
- Category management → Add category: links to add (evidence: `admin/category.php`)
- Add category → Application database: writes category (evidence: `admin/add_categories.php`)
- Table management → Application database: queries tables (evidence: `admin/tables.php`)
- Table management → Add table: links to add (evidence: `admin/tables.php`)
- Add table → Application database: writes table (evidence: `admin/add_table.php`)
- Table management → Table QR generation: requests QR (evidence: `admin/tables.php`)
- Table QR generation → QR encoder: encodes table URL (evidence: `admin/GenerateQR.php`)
- Table QR generation → Application database: saves QR path (evidence: `admin/GenerateQR.php`)
- Register account → Application database: checks and creates user (evidence: `process_register.php`)
- Sign in → Application database: checks credentials (evidence: `login.php`)
- Sign in → User dashboard: redirects on success (evidence: `login.php`)
