# shindawn/bestiecoffeecafe architecture

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

- Interactive diagram: https://gitdiagram.com/shindawn/bestiecoffeecafe
- Repository: https://github.com/shindawn/bestiecoffeecafe

## Overview

BestieTrack is a PHP branch-operations system for point-of-sale sales, products and inventory, raw materials, inter-branch transfers, expenses, users, and administration. A typical staff workflow is to browse the sales menu, manage a cart, and complete a sale; branch staff and administrators also manage inventory and transfers through role-specific pages and API endpoints. The sampled files show shared database access and selected model/API relationships. The README is empty, and many endpoints and screens were not sampled, so those capabilities are included without speculative call flows.

Main entry points: [`include/activity_logger.php`](https://github.com/shindawn/bestiecoffeecafe/blob/main/include/activity_logger.php) (Activity logging), [`config/Database.php`](https://github.com/shindawn/bestiecoffeecafe/blob/main/config/Database.php) (Database access), [`models/User.php`](https://github.com/shindawn/bestiecoffeecafe/blob/main/models/User.php) (User model), [`staff/index.php`](https://github.com/shindawn/bestiecoffeecafe/blob/main/staff/index.php) (Staff POS)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Role interfaces"]
  node_staff["Staff POS<br/>[index.php]"]
  node_admin_inventory["Admin inventory<br/>[inventory.php]"]
  node_main_inventory["Main inventory<br/>[inventory.php]"]
  node_sub_inventory["Sub inventory<br/>[inventory.php]"]
  node_login["Login<br/>[index.php]"]
end

subgraph group_operations["Sales and stock"]
  node_sales["Sales and cart APIs<br/>[checkout.php]"]
  node_cart_model["Cart model<br/>[Cart.php]"]
  node_inventory_api["Inventory APIs<br/>[get_inventory.php]"]
  node_inventory_model["Inventory model<br/>[Inventory.php]"]
  node_materials["Raw materials<br/>[create.php]"]
  node_material_model["Material model<br/>[Material.php]"]
  node_transfers["Transfer workflows"]
  node_transfer_model["Transfer model<br/>[Transfer.php]"]
  node_verification["Transfer verification<br/>[index.php]"]
end

subgraph group_governance["Branch administration"]
  node_branches["Branch management<br/>[add_branch.php]"]
  node_expenses["Expense management<br/>[create.php]"]
  node_users["User management<br/>[create.php]"]
  node_permissions["Roles and permissions<br/>[update.php]"]
  node_menu_model["Menu permissions<br/>[Menu.php]"]
  node_backups["Backup management<br/>[restore.php]"]
end

subgraph group_foundation["Shared services"]
  node_database[("Database access<br/>[Database.php]")]
  node_activity["Activity logging"]
  node_notifications["Notifications<br/>[list.php]"]
  node_notification_model["Notification model<br/>[Notification.php]"]
  node_user_model["User model<br/>[User.php]"]
  node_branch_model["Branch model<br/>[Branch.php]"]
  node_expense_model["Expense model<br/>[Expense.php]"]
  node_backup_model["Backup model<br/>[Backup.php]"]
  node_page_security["Session security<br/>[security.php]"]
end

node_staff -->|"fetches cart"| node_sales
node_staff -.->|"uses cart"| node_cart_model
node_admin_inventory -->|"opens connection"| node_database
node_main_inventory -->|"opens connection"| node_database
node_sub_inventory -->|"opens connection"| node_database
node_main_inventory -->|"uses model"| node_inventory_model
node_admin_inventory -->|"uses model"| node_material_model
node_main_inventory -->|"uses model"| node_material_model
node_sub_inventory -->|"uses model"| node_material_model
node_login -->|"authenticates with"| node_user_model
node_login -->|"loads branch"| node_branch_model
node_verification -->|"loads user"| node_user_model
node_verification -->|"loads transfer"| node_transfer_model
node_permissions -->|"uses database"| node_database
node_permissions -->|"updates permissions"| node_menu_model
node_backups -->|"restores backup"| node_backup_model
node_notifications -->|"lists notifications"| node_notification_model
node_notifications -->|"checks user"| node_user_model
node_activity -->|"uses model"| node_notification_model
node_activity -->|"uses model"| node_expense_model
node_activity -->|"uses model"| node_transfer_model
node_activity -->|"uses model"| node_inventory_model
node_activity -->|"uses model"| node_user_model
node_users -->|"uses model"| node_user_model
node_expenses -->|"updates expense"| node_expense_model
node_expenses -->|"uses database"| node_database
node_staff -->|"requires session"| node_page_security

click node_staff "https://github.com/shindawn/bestiecoffeecafe/blob/main/staff/index.php"
click node_admin_inventory "https://github.com/shindawn/bestiecoffeecafe/blob/main/admin/inventory.php"
click node_main_inventory "https://github.com/shindawn/bestiecoffeecafe/blob/main/main/inventory.php"
click node_sub_inventory "https://github.com/shindawn/bestiecoffeecafe/blob/main/sub/inventory.php"
click node_login "https://github.com/shindawn/bestiecoffeecafe/blob/main/index.php"
click node_sales "https://github.com/shindawn/bestiecoffeecafe/blob/main/api/checkout.php"
click node_cart_model "https://github.com/shindawn/bestiecoffeecafe/blob/main/models/Cart.php"
click node_inventory_api "https://github.com/shindawn/bestiecoffeecafe/blob/main/api/get_inventory.php"
click node_inventory_model "https://github.com/shindawn/bestiecoffeecafe/blob/main/models/Inventory.php"
click node_materials "https://github.com/shindawn/bestiecoffeecafe/blob/main/api/materials/create.php"
click node_material_model "https://github.com/shindawn/bestiecoffeecafe/blob/main/models/Material.php"
click node_transfers "https://github.com/shindawn/bestiecoffeecafe/blob/main/api/create_transfer.php"
click node_transfer_model "https://github.com/shindawn/bestiecoffeecafe/blob/main/models/Transfer.php"
click node_verification "https://github.com/shindawn/bestiecoffeecafe/blob/main/verification/index.php"
click node_branches "https://github.com/shindawn/bestiecoffeecafe/blob/main/api/add_branch.php"
click node_expenses "https://github.com/shindawn/bestiecoffeecafe/blob/main/api/expenses/create.php"
click node_users "https://github.com/shindawn/bestiecoffeecafe/blob/main/api/users/create.php"
click node_permissions "https://github.com/shindawn/bestiecoffeecafe/blob/main/api/roles/update.php"
click node_menu_model "https://github.com/shindawn/bestiecoffeecafe/blob/main/models/Menu.php"
click node_backups "https://github.com/shindawn/bestiecoffeecafe/blob/main/api/admin/backups/restore.php"
click node_database "https://github.com/shindawn/bestiecoffeecafe/blob/main/config/Database.php"
click node_activity "https://github.com/shindawn/bestiecoffeecafe/blob/main/include/activity_logger.php"
click node_notifications "https://github.com/shindawn/bestiecoffeecafe/blob/main/api/notifications/list.php"
click node_notification_model "https://github.com/shindawn/bestiecoffeecafe/blob/main/models/Notification.php"
click node_user_model "https://github.com/shindawn/bestiecoffeecafe/blob/main/models/User.php"
click node_branch_model "https://github.com/shindawn/bestiecoffeecafe/blob/main/models/Branch.php"
click node_expense_model "https://github.com/shindawn/bestiecoffeecafe/blob/main/models/Expense.php"
click node_backup_model "https://github.com/shindawn/bestiecoffeecafe/blob/main/models/Backup.php"
click node_page_security "https://github.com/shindawn/bestiecoffeecafe/blob/main/include/security.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_staff,node_admin_inventory,node_main_inventory,node_sub_inventory,node_login toneBlue
class node_sales,node_cart_model,node_inventory_api,node_inventory_model,node_materials,node_material_model,node_transfers,node_transfer_model,node_verification toneAmber
class node_branches,node_expenses,node_users,node_permissions,node_menu_model,node_backups toneMint
class node_database,node_activity,node_notifications,node_notification_model,node_user_model,node_branch_model,node_expense_model,node_backup_model,node_page_security toneRose
```

## Components

### Role interfaces

- [Staff POS](https://github.com/shindawn/bestiecoffeecafe/blob/main/staff/index.php): `staff/index.php`
- [Admin inventory](https://github.com/shindawn/bestiecoffeecafe/blob/main/admin/inventory.php): `admin/inventory.php`
- [Main inventory](https://github.com/shindawn/bestiecoffeecafe/blob/main/main/inventory.php): `main/inventory.php`
- [Sub inventory](https://github.com/shindawn/bestiecoffeecafe/blob/main/sub/inventory.php): `sub/inventory.php`
- [Login](https://github.com/shindawn/bestiecoffeecafe/blob/main/index.php): `index.php`

### Sales and stock

- [Sales and cart APIs](https://github.com/shindawn/bestiecoffeecafe/blob/main/api/checkout.php): `api/checkout.php`
- [Cart model](https://github.com/shindawn/bestiecoffeecafe/blob/main/models/Cart.php): `models/Cart.php`
- [Inventory APIs](https://github.com/shindawn/bestiecoffeecafe/blob/main/api/get_inventory.php): `api/get_inventory.php`
- [Inventory model](https://github.com/shindawn/bestiecoffeecafe/blob/main/models/Inventory.php): `models/Inventory.php`
- [Raw materials](https://github.com/shindawn/bestiecoffeecafe/blob/main/api/materials/create.php): `api/materials/create.php`
- [Material model](https://github.com/shindawn/bestiecoffeecafe/blob/main/models/Material.php): `models/Material.php`
- [Transfer workflows](https://github.com/shindawn/bestiecoffeecafe/blob/main/api/create_transfer.php): `api/create_transfer.php`
- [Transfer model](https://github.com/shindawn/bestiecoffeecafe/blob/main/models/Transfer.php): `models/Transfer.php`
- [Transfer verification](https://github.com/shindawn/bestiecoffeecafe/blob/main/verification/index.php): `verification/index.php`

### Branch administration

- [Branch management](https://github.com/shindawn/bestiecoffeecafe/blob/main/api/add_branch.php): `api/add_branch.php`
- [Expense management](https://github.com/shindawn/bestiecoffeecafe/blob/main/api/expenses/create.php): `api/expenses/create.php`
- [User management](https://github.com/shindawn/bestiecoffeecafe/blob/main/api/users/create.php): `api/users/create.php`
- [Roles and permissions](https://github.com/shindawn/bestiecoffeecafe/blob/main/api/roles/update.php): `api/roles/update.php`
- [Menu permissions](https://github.com/shindawn/bestiecoffeecafe/blob/main/models/Menu.php): `models/Menu.php`
- [Backup management](https://github.com/shindawn/bestiecoffeecafe/blob/main/api/admin/backups/restore.php): `api/admin/backups/restore.php`

### Shared services

- [Database access](https://github.com/shindawn/bestiecoffeecafe/blob/main/config/Database.php): `config/Database.php`
- [Activity logging](https://github.com/shindawn/bestiecoffeecafe/blob/main/include/activity_logger.php): `include/activity_logger.php`
- [Notifications](https://github.com/shindawn/bestiecoffeecafe/blob/main/api/notifications/list.php): `api/notifications/list.php`
- [Notification model](https://github.com/shindawn/bestiecoffeecafe/blob/main/models/Notification.php): `models/Notification.php`
- [User model](https://github.com/shindawn/bestiecoffeecafe/blob/main/models/User.php): `models/User.php`
- [Branch model](https://github.com/shindawn/bestiecoffeecafe/blob/main/models/Branch.php): `models/Branch.php`
- [Expense model](https://github.com/shindawn/bestiecoffeecafe/blob/main/models/Expense.php): `models/Expense.php`
- [Backup model](https://github.com/shindawn/bestiecoffeecafe/blob/main/models/Backup.php): `models/Backup.php`
- [Session security](https://github.com/shindawn/bestiecoffeecafe/blob/main/include/security.php): `include/security.php`

## Connections

- Staff POS → Sales and cart APIs: fetches cart (evidence: `staff/index.php`)
- Staff POS → Cart model: uses cart (evidence: `staff/index.php`)
- Admin inventory → Database access: opens connection (evidence: `admin/inventory.php`)
- Main inventory → Database access: opens connection (evidence: `main/inventory.php`)
- Sub inventory → Database access: opens connection (evidence: `sub/inventory.php`)
- Main inventory → Inventory model: uses model (evidence: `main/inventory.php`)
- Admin inventory → Material model: uses model (evidence: `admin/inventory.php`)
- Main inventory → Material model: uses model (evidence: `main/inventory.php`)
- Sub inventory → Material model: uses model (evidence: `sub/inventory.php`)
- Login → User model: authenticates with
- Login → Branch model: loads branch (evidence: `index.php`)
- Transfer verification → User model: loads user (evidence: `verification/index.php`)
- Transfer verification → Transfer model: loads transfer (evidence: `verification/index.php`)
- Roles and permissions → Database access: uses database (evidence: `api/roles/update.php`)
- Roles and permissions → Menu permissions: updates permissions
- Backup management → Backup model: restores backup (evidence: `api/admin/backups/restore.php`)
- Notifications → Notification model: lists notifications (evidence: `api/notifications/list.php`)
- Notifications → User model: checks user (evidence: `api/notifications/list.php`)
- Activity logging → Notification model: uses model (evidence: `include/activity_logger.php`)
- Activity logging → Expense model: uses model (evidence: `include/activity_logger.php`)
- Activity logging → Transfer model: uses model (evidence: `include/activity_logger.php`)
- Activity logging → Inventory model: uses model (evidence: `include/activity_logger.php`)
- Activity logging → User model: uses model (evidence: `include/activity_logger.php`)
- User management → User model: uses model
- Expense management → Expense model: updates expense
- Expense management → Database access: uses database
- Staff POS → Session security: requires session (evidence: `staff/index.php`)
