# hqzeeee/primeburger architecture

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

- Interactive diagram: https://gitdiagram.com/hqzeeee/primeburger
- Repository: https://github.com/hqzeeee/primeburger

## Overview

PrimeBurger IMS is a PHP/MySQL inventory application for owner and staff users. The main workflow is to authenticate, maintain categories, suppliers, and products, record stock movements, then monitor dashboard metrics and alerts or review reports and exports. Product codes and QR lookup support scanning physical stock; expiry classification and low-stock detection feed notifications. The graph reflects the documented page capabilities and the sampled controller, model, authentication, and notification code. Several page-to-model links are documented but their page implementations were not sampled, so those links show documented responsibility rather than inspected call sites.

Main entry points: [`app/models/UserModel.php`](https://github.com/hqzeeee/primeburger/blob/main/app/models/UserModel.php) (User Model), [`app/models/ProductModel.php`](https://github.com/hqzeeee/primeburger/blob/main/app/models/ProductModel.php) (Product Model), [`app/core/Auth.php`](https://github.com/hqzeeee/primeburger/blob/main/app/core/Auth.php) (Session / RBAC), [`app/core/Model.php`](https://github.com/hqzeeee/primeburger/blob/main/app/core/Model.php) (Model Base)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and Security"]
  node_login["Login Page<br/>[login.php]"]
  node_authcontroller["Auth Controller<br/>[AuthController.php]"]
  node_auth["Session / RBAC<br/>[Auth.php]"]
  node_userspage["User Management<br/>[users.php]"]
  node_usercontroller["User Controller<br/>[UserController.php]"]
  node_usermodel["User Model<br/>[UserModel.php]"]
end

subgraph group_inventory["Inventory Operations"]
  node_productpage["Product Management<br/>[products.php]"]
  node_productcontroller["Product Controller"]
  node_productmodel["Product Model<br/>[ProductModel.php]"]
  node_stockpage["Stock Management<br/>[stock.php]"]
  node_stockcontroller["Stock Controller"]
  node_transactions["Transaction Model"]
  node_settings["Settings<br/>[settings.php]"]
  node_categories["Category Model<br/>[CategoryModel.php]"]
  node_suppliers["Supplier Model<br/>[SupplierModel.php]"]
  node_scanner["QR Scanner<br/>[qr-scanner.php]"]
  node_qrapi["QR Lookup API<br/>[qr-lookup.php]"]
end

subgraph group_monitoring["Monitoring and Reports"]
  node_dashboard["Dashboard<br/>[dashboard.php]"]
  node_notificationspage["Notifications Page<br/>[notifications.php]"]
  node_notificationservice["Notification Service"]
  node_reports["Reports<br/>[reports.php]"]
  node_reportmodel["Report Model<br/>[ReportModel.php]"]
  node_export["Report Export<br/>[export.php]"]
end

subgraph group_foundation["Application Foundation"]
  node_database[("MySQL Inventory Store<br/>[schema.sql]")]
  node_modelbase["Model Base<br/>[Model.php]"]
  node_dbconnection["PDO Connection<br/>[Database.php]"]
  node_bootstrap["Application Bootstrap<br/>[bootstrap.php]"]
  node_activity["Activity Logger<br/>[ActivityLogger.php]"]
end

node_staff(("Owner / Staff"))
node_camera(("Device Camera"))
node_browser(("Browser Print"))

node_staff -->|"submits credentials"| node_login
node_login -->|"handles login"| node_authcontroller
node_authcontroller -->|"attempts login"| node_auth
node_auth -->|"looks up account"| node_usermodel
node_auth -->|"updates login"| node_usermodel
node_userspage -->|"manages accounts"| node_usercontroller
node_usercontroller -->|"creates / updates"| node_usermodel
node_productpage -->|"writes product changes"| node_productcontroller
node_productpage -->|"searches products"| node_productmodel
node_productcontroller -->|"creates / updates"| node_productmodel
node_stockpage -->|"records movement"| node_stockcontroller
node_stockcontroller -->|"records transaction"| node_transactions
node_settings -->|"changes own password"| node_usermodel
node_settings -->|"manages categories"| node_categories
node_settings -->|"manages suppliers"| node_suppliers
node_scanner -.->|"scans code"| node_camera
node_scanner -->|"looks up code"| node_qrapi
node_qrapi -->|"finds QR match"| node_productmodel
node_qrapi -->|"fallback code lookup"| node_dbconnection
node_dashboard -->|"loads metrics"| node_productmodel
node_dashboard -->|"syncs alerts"| node_notificationservice
node_notificationspage -->|"syncs / lists alerts"| node_notificationservice
node_notificationservice -->|"reads / writes alerts"| node_dbconnection
node_reports -->|"loads reports"| node_reportmodel
node_reports -->|"requests export"| node_export
node_reports -->|"prints report"| node_browser
node_export -->|"loads report data"| node_reportmodel
node_bootstrap -->|"starts session"| node_auth
node_productmodel -->|"uses queries"| node_modelbase
node_transactions -->|"uses queries"| node_modelbase
node_usermodel -->|"uses queries"| node_modelbase
node_modelbase -->|"gets connection"| node_dbconnection
node_dbconnection -->|"connects to"| node_database
node_usercontroller -->|"logs changes"| node_activity
node_productcontroller -->|"logs changes"| node_activity
node_stockcontroller -->|"logs movement"| node_activity

click node_login "https://github.com/hqzeeee/primeburger/blob/main/login.php"
click node_authcontroller "https://github.com/hqzeeee/primeburger/blob/main/app/controllers/AuthController.php"
click node_auth "https://github.com/hqzeeee/primeburger/blob/main/app/core/Auth.php"
click node_userspage "https://github.com/hqzeeee/primeburger/blob/main/users.php"
click node_usercontroller "https://github.com/hqzeeee/primeburger/blob/main/app/controllers/UserController.php"
click node_usermodel "https://github.com/hqzeeee/primeburger/blob/main/app/models/UserModel.php"
click node_productpage "https://github.com/hqzeeee/primeburger/blob/main/products.php"
click node_productcontroller "https://github.com/hqzeeee/primeburger/blob/main/app/controllers/ProductController.php"
click node_productmodel "https://github.com/hqzeeee/primeburger/blob/main/app/models/ProductModel.php"
click node_stockpage "https://github.com/hqzeeee/primeburger/blob/main/stock.php"
click node_stockcontroller "https://github.com/hqzeeee/primeburger/blob/main/app/controllers/StockController.php"
click node_transactions "https://github.com/hqzeeee/primeburger/blob/main/app/models/InventoryTransactionModel.php"
click node_settings "https://github.com/hqzeeee/primeburger/blob/main/settings.php"
click node_categories "https://github.com/hqzeeee/primeburger/blob/main/app/models/CategoryModel.php"
click node_suppliers "https://github.com/hqzeeee/primeburger/blob/main/app/models/SupplierModel.php"
click node_scanner "https://github.com/hqzeeee/primeburger/blob/main/qr-scanner.php"
click node_qrapi "https://github.com/hqzeeee/primeburger/blob/main/api/qr-lookup.php"
click node_dashboard "https://github.com/hqzeeee/primeburger/blob/main/dashboard.php"
click node_notificationspage "https://github.com/hqzeeee/primeburger/blob/main/notifications.php"
click node_notificationservice "https://github.com/hqzeeee/primeburger/blob/main/app/services/NotificationService.php"
click node_reports "https://github.com/hqzeeee/primeburger/blob/main/reports.php"
click node_reportmodel "https://github.com/hqzeeee/primeburger/blob/main/app/models/ReportModel.php"
click node_export "https://github.com/hqzeeee/primeburger/blob/main/export.php"
click node_database "https://github.com/hqzeeee/primeburger/blob/main/database/schema.sql"
click node_modelbase "https://github.com/hqzeeee/primeburger/blob/main/app/core/Model.php"
click node_dbconnection "https://github.com/hqzeeee/primeburger/blob/main/app/core/Database.php"
click node_bootstrap "https://github.com/hqzeeee/primeburger/blob/main/app/bootstrap.php"
click node_activity "https://github.com/hqzeeee/primeburger/blob/main/app/services/ActivityLogger.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_login,node_authcontroller,node_auth,node_userspage,node_usercontroller,node_usermodel,node_browser toneBlue
class node_productpage,node_productcontroller,node_productmodel,node_stockpage,node_stockcontroller,node_transactions,node_settings,node_categories,node_suppliers,node_scanner,node_qrapi toneAmber
class node_dashboard,node_notificationspage,node_notificationservice,node_reports,node_reportmodel,node_export toneMint
class node_database,node_modelbase,node_dbconnection,node_bootstrap,node_activity toneRose
class node_staff,node_camera toneIndigo
```

## Components

### Access and Security

- [Login Page](https://github.com/hqzeeee/primeburger/blob/main/login.php): `login.php`
- [Auth Controller](https://github.com/hqzeeee/primeburger/blob/main/app/controllers/AuthController.php): `app/controllers/AuthController.php`
- [Session / RBAC](https://github.com/hqzeeee/primeburger/blob/main/app/core/Auth.php): `app/core/Auth.php`
- [User Management](https://github.com/hqzeeee/primeburger/blob/main/users.php): `users.php`
- [User Controller](https://github.com/hqzeeee/primeburger/blob/main/app/controllers/UserController.php): `app/controllers/UserController.php`
- [User Model](https://github.com/hqzeeee/primeburger/blob/main/app/models/UserModel.php): `app/models/UserModel.php`

### Inventory Operations

- [Product Management](https://github.com/hqzeeee/primeburger/blob/main/products.php): `products.php`
- [Product Controller](https://github.com/hqzeeee/primeburger/blob/main/app/controllers/ProductController.php): `app/controllers/ProductController.php`
- [Product Model](https://github.com/hqzeeee/primeburger/blob/main/app/models/ProductModel.php): `app/models/ProductModel.php`
- [Stock Management](https://github.com/hqzeeee/primeburger/blob/main/stock.php): `stock.php`
- [Stock Controller](https://github.com/hqzeeee/primeburger/blob/main/app/controllers/StockController.php): `app/controllers/StockController.php`
- [Transaction Model](https://github.com/hqzeeee/primeburger/blob/main/app/models/InventoryTransactionModel.php): `app/models/InventoryTransactionModel.php`
- [Settings](https://github.com/hqzeeee/primeburger/blob/main/settings.php): `settings.php`
- [Category Model](https://github.com/hqzeeee/primeburger/blob/main/app/models/CategoryModel.php): `app/models/CategoryModel.php`
- [Supplier Model](https://github.com/hqzeeee/primeburger/blob/main/app/models/SupplierModel.php): `app/models/SupplierModel.php`
- [QR Scanner](https://github.com/hqzeeee/primeburger/blob/main/qr-scanner.php): `qr-scanner.php`
- [QR Lookup API](https://github.com/hqzeeee/primeburger/blob/main/api/qr-lookup.php): `api/qr-lookup.php`

### Monitoring and Reports

- [Dashboard](https://github.com/hqzeeee/primeburger/blob/main/dashboard.php): `dashboard.php`
- [Notifications Page](https://github.com/hqzeeee/primeburger/blob/main/notifications.php): `notifications.php`
- [Notification Service](https://github.com/hqzeeee/primeburger/blob/main/app/services/NotificationService.php): `app/services/NotificationService.php`
- [Reports](https://github.com/hqzeeee/primeburger/blob/main/reports.php): `reports.php`
- [Report Model](https://github.com/hqzeeee/primeburger/blob/main/app/models/ReportModel.php): `app/models/ReportModel.php`
- [Report Export](https://github.com/hqzeeee/primeburger/blob/main/export.php): `export.php`

### Application Foundation

- [MySQL Inventory Store](https://github.com/hqzeeee/primeburger/blob/main/database/schema.sql): `database/schema.sql`
- [Model Base](https://github.com/hqzeeee/primeburger/blob/main/app/core/Model.php): `app/core/Model.php`
- [PDO Connection](https://github.com/hqzeeee/primeburger/blob/main/app/core/Database.php): `app/core/Database.php`
- [Application Bootstrap](https://github.com/hqzeeee/primeburger/blob/main/app/bootstrap.php): `app/bootstrap.php`
- [Activity Logger](https://github.com/hqzeeee/primeburger/blob/main/app/services/ActivityLogger.php): `app/services/ActivityLogger.php`

### Other components

- **Owner / Staff**
- **Device Camera**
- **Browser Print**

## Connections

- Owner / Staff → Login Page: submits credentials
- Login Page → Auth Controller: handles login
- Auth Controller → Session / RBAC: attempts login
- Session / RBAC → User Model: looks up account
- Session / RBAC → User Model: updates login
- User Management → User Controller: manages accounts
- User Controller → User Model: creates / updates
- Product Management → Product Controller: writes product changes
- Product Management → Product Model: searches products
- Product Controller → Product Model: creates / updates
- Stock Management → Stock Controller: records movement
- Stock Controller → Transaction Model: records transaction
- Settings → User Model: changes own password
- Settings → Category Model: manages categories
- Settings → Supplier Model: manages suppliers
- QR Scanner → Device Camera: scans code
- QR Scanner → QR Lookup API: looks up code
- QR Lookup API → Product Model: finds QR match
- QR Lookup API → PDO Connection: fallback code lookup
- Dashboard → Product Model: loads metrics
- Dashboard → Notification Service: syncs alerts
- Notifications Page → Notification Service: syncs / lists alerts
- Notification Service → PDO Connection: reads / writes alerts
- Reports → Report Model: loads reports
- Reports → Report Export: requests export
- Reports → Browser Print: prints report
- Report Export → Report Model: loads report data
- Application Bootstrap → Session / RBAC: starts session
- Product Model → Model Base: uses queries
- Transaction Model → Model Base: uses queries
- User Model → Model Base: uses queries
- Model Base → PDO Connection: gets connection
- PDO Connection → MySQL Inventory Store: connects to
- User Controller → Activity Logger: logs changes
- Product Controller → Activity Logger: logs changes
- Stock Controller → Activity Logger: logs movement
