# anthonys4b/capstone architecture

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

- Interactive diagram: https://gitdiagram.com/anthonys4b/capstone
- Repository: https://github.com/anthonys4b/capstone

## Overview

This is a PHP point-of-sale and inventory application with cashier and owner/employee workflows. A cashier enters through the login and POS screens, submits a sale for validation and stock deduction, and can review transactions; staff also manage products, categories, and inventory history. Owner-facing administration, dashboards, and a Python recommendation service are supporting capabilities. The tree and excerpts establish the transaction, catalog, session, and recommendation components, but do not show every page-to-endpoint link, so uncertain wiring is omitted.

Main entry points: [`config/database.php`](https://github.com/anthonys4b/capstone/blob/main/config/database.php) (Database connection), [`ajax/transaction_ajax.php`](https://github.com/anthonys4b/capstone/blob/main/ajax/transaction_ajax.php) (Sale processing), [`controllers/CategoryController.php`](https://github.com/anthonys4b/capstone/blob/main/controllers/CategoryController.php) (Category operations), [`categories.php`](https://github.com/anthonys4b/capstone/blob/main/categories.php) (Catalog management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sales["Point of sale"]
  node_pos["POS interface<br/>[PosUI_db.php]"]
  node_sale_api["Sale processing"]
  node_sale_history["Sales transactions"]
end

subgraph group_inventory["Inventory"]
  node_catalog_ui["Catalog management<br/>[categories.php]"]
  node_product_api["Product operations"]
  node_category_api["Category operations"]
  node_category_ajax["Category requests<br/>[category_ajax.php]"]
  node_inventory_log["Inventory history"]
  node_archive["Archived products"]
  node_inventory_ajax["Inventory requests<br/>[inventory_ajax.php]"]
end

subgraph group_insights["Insights"]
  node_staffdash["Staff dashboard"]
  node_owner_dash["Owner dashboard<br/>[dashboard.php]"]
  node_dashboard_ajax["Dashboard charts"]
  node_reco_ui["Recommendations view<br/>[reco.php]"]
  node_reco_ajax["Recommendation requests"]
  node_ml_api["Recommendation service<br/>[api_server.py]"]
  node_ml_data["ML data processing<br/>[data_service.py]"]
end

subgraph group_identity["Accounts and admin"]
  node_login["Sign in<br/>[Login.php]"]
  node_account_admin["User administration<br/>[user_ajax.php]"]
  node_session_log["Session tracking"]
end

subgraph group_storage["Data access"]
  node_database_config["Database connection<br/>[database.php]"]
  node_product_store[("Application database<br/>[database.php]")]
end

node_cashier(("Cashier or owner"))

node_cashier -->|"signs in"| node_login
node_cashier -->|"starts sale"| node_pos
node_login -->|"records session"| node_session_log
node_staffdash -->|"views sales"| node_sale_history
node_pos -->|"submits sale"| node_sale_api
node_sale_api -->|"opens connection"| node_database_config
node_sale_api -->|"reads and updates"| node_product_store
node_sale_history -->|"requests transactions"| node_sale_api
node_catalog_ui -->|"requests categories"| node_category_ajax
node_category_ajax -->|"invokes"| node_category_api
node_catalog_ui -->|"requests inventory"| node_inventory_ajax
node_inventory_ajax -->|"invokes"| node_product_api
node_category_api -->|"opens connection"| node_database_config
node_product_api -->|"opens connection"| node_database_config
node_database_config -->|"connects"| node_product_store
node_inventory_log -->|"opens connection"| node_database_config
node_inventory_log -->|"loads categories"| node_category_api
node_archive -->|"opens connection"| node_database_config
node_owner_dash -->|"requests charts"| node_dashboard_ajax
node_reco_ui -.->|"requests recommendations"| node_reco_ajax
node_reco_ajax -.->|"requests analysis"| node_ml_api
node_ml_api -->|"extracts features"| node_ml_data
node_ml_data -->|"reads product data"| node_product_store
node_account_admin -->|"opens connection"| node_database_config

click node_login "https://github.com/anthonys4b/capstone/blob/main/Login.php"
click node_staffdash "https://github.com/anthonys4b/capstone/blob/main/employee_dashboard.php"
click node_owner_dash "https://github.com/anthonys4b/capstone/blob/main/dashboard.php"
click node_pos "https://github.com/anthonys4b/capstone/blob/main/PosUI_db.php"
click node_sale_api "https://github.com/anthonys4b/capstone/blob/main/ajax/transaction_ajax.php"
click node_sale_history "https://github.com/anthonys4b/capstone/blob/main/Sales_Transactions.php"
click node_catalog_ui "https://github.com/anthonys4b/capstone/blob/main/categories.php"
click node_product_api "https://github.com/anthonys4b/capstone/blob/main/controllers/ProductController.php"
click node_category_api "https://github.com/anthonys4b/capstone/blob/main/controllers/CategoryController.php"
click node_category_ajax "https://github.com/anthonys4b/capstone/blob/main/ajax/category_ajax.php"
click node_inventory_log "https://github.com/anthonys4b/capstone/blob/main/inventory_management.php"
click node_archive "https://github.com/anthonys4b/capstone/blob/main/archive_products.php"
click node_inventory_ajax "https://github.com/anthonys4b/capstone/blob/main/ajax/inventory_ajax.php"
click node_dashboard_ajax "https://github.com/anthonys4b/capstone/blob/main/ajax/dashboard_chart_ajax.php"
click node_reco_ui "https://github.com/anthonys4b/capstone/blob/main/reco.php"
click node_reco_ajax "https://github.com/anthonys4b/capstone/blob/main/ajax/ml_recommendation_ajax.php"
click node_ml_api "https://github.com/anthonys4b/capstone/blob/main/ml/api_server.py"
click node_ml_data "https://github.com/anthonys4b/capstone/blob/main/ml/data_service.py"
click node_account_admin "https://github.com/anthonys4b/capstone/blob/main/ajax/user_ajax.php"
click node_session_log "https://github.com/anthonys4b/capstone/blob/main/includes/session_tracker.php"
click node_database_config "https://github.com/anthonys4b/capstone/blob/main/config/database.php"
click node_product_store "https://github.com/anthonys4b/capstone/blob/main/config/database.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_pos,node_sale_api,node_sale_history toneBlue
class node_catalog_ui,node_product_api,node_category_api,node_category_ajax,node_inventory_log,node_archive,node_inventory_ajax toneAmber
class node_staffdash,node_owner_dash,node_dashboard_ajax,node_reco_ui,node_reco_ajax,node_ml_api,node_ml_data toneMint
class node_login,node_account_admin,node_session_log toneRose
class node_database_config,node_product_store,node_cashier toneIndigo
```

## Components

### Point of sale

- [POS interface](https://github.com/anthonys4b/capstone/blob/main/PosUI_db.php): `PosUI_db.php`
- [Sale processing](https://github.com/anthonys4b/capstone/blob/main/ajax/transaction_ajax.php): `ajax/transaction_ajax.php`
- [Sales transactions](https://github.com/anthonys4b/capstone/blob/main/Sales_Transactions.php): `Sales_Transactions.php`

### Inventory

- [Catalog management](https://github.com/anthonys4b/capstone/blob/main/categories.php): `categories.php`
- [Product operations](https://github.com/anthonys4b/capstone/blob/main/controllers/ProductController.php): `controllers/ProductController.php`
- [Category operations](https://github.com/anthonys4b/capstone/blob/main/controllers/CategoryController.php): `controllers/CategoryController.php`
- [Category requests](https://github.com/anthonys4b/capstone/blob/main/ajax/category_ajax.php): `ajax/category_ajax.php`
- [Inventory history](https://github.com/anthonys4b/capstone/blob/main/inventory_management.php): `inventory_management.php`
- [Archived products](https://github.com/anthonys4b/capstone/blob/main/archive_products.php): `archive_products.php`
- [Inventory requests](https://github.com/anthonys4b/capstone/blob/main/ajax/inventory_ajax.php): `ajax/inventory_ajax.php`

### Insights

- [Staff dashboard](https://github.com/anthonys4b/capstone/blob/main/employee_dashboard.php): `employee_dashboard.php`
- [Owner dashboard](https://github.com/anthonys4b/capstone/blob/main/dashboard.php): `dashboard.php`
- [Dashboard charts](https://github.com/anthonys4b/capstone/blob/main/ajax/dashboard_chart_ajax.php): `ajax/dashboard_chart_ajax.php`
- [Recommendations view](https://github.com/anthonys4b/capstone/blob/main/reco.php): `reco.php`
- [Recommendation requests](https://github.com/anthonys4b/capstone/blob/main/ajax/ml_recommendation_ajax.php): `ajax/ml_recommendation_ajax.php`
- [Recommendation service](https://github.com/anthonys4b/capstone/blob/main/ml/api_server.py): `ml/api_server.py`
- [ML data processing](https://github.com/anthonys4b/capstone/blob/main/ml/data_service.py): `ml/data_service.py`

### Accounts and admin

- [Sign in](https://github.com/anthonys4b/capstone/blob/main/Login.php): `Login.php`
- [User administration](https://github.com/anthonys4b/capstone/blob/main/ajax/user_ajax.php): `ajax/user_ajax.php`
- [Session tracking](https://github.com/anthonys4b/capstone/blob/main/includes/session_tracker.php): `includes/session_tracker.php`

### Data access

- [Database connection](https://github.com/anthonys4b/capstone/blob/main/config/database.php): `config/database.php`
- [Application database](https://github.com/anthonys4b/capstone/blob/main/config/database.php): `config/database.php`

### Other components

- **Cashier or owner**

## Connections

- Cashier or owner → Sign in: signs in
- Cashier or owner → POS interface: starts sale
- Sign in → Session tracking: records session
- Staff dashboard → Sales transactions: views sales
- POS interface → Sale processing: submits sale
- Sale processing → Database connection: opens connection
- Sale processing → Application database: reads and updates
- Sales transactions → Sale processing: requests transactions
- Catalog management → Category requests: requests categories
- Category requests → Category operations: invokes
- Catalog management → Inventory requests: requests inventory
- Inventory requests → Product operations: invokes
- Category operations → Database connection: opens connection
- Product operations → Database connection: opens connection
- Database connection → Application database: connects
- Inventory history → Database connection: opens connection
- Inventory history → Category operations: loads categories
- Archived products → Database connection: opens connection
- Owner dashboard → Dashboard charts: requests charts
- Recommendations view → Recommendation requests: requests recommendations
- Recommendation requests → Recommendation service: requests analysis
- Recommendation service → ML data processing: extracts features
- ML data processing → Application database: reads product data
- User administration → Database connection: opens connection
