# xnightm4re-cse/shopeasy-ecommerce architecture

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

- Interactive diagram: https://gitdiagram.com/xnightm4re-cse/shopeasy-ecommerce
- Repository: https://github.com/xnightm4re-cse/shopeasy-ecommerce

## Overview

ShopEasy is a PHP/MySQL online store with a customer storefront and a separately authenticated administration portal. The customer workflow runs from registration or login through catalog browsing, cart management, checkout, and order tracking; administrators manage inventory, categories, customers, and order status. Shared PHP helpers and the database connection support both areas. The graph uses sampled source and README capabilities; links for unsampled stages are documented rather than inferred from names alone.

Main entry points: [`cart.php`](https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/cart.php) (Shopping Cart), [`index.php`](https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/index.php) (Home Page), [`checkout.php`](https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/checkout.php) (Checkout), [`products.php`](https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/products.php) (Product Catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Customer Storefront"]
  node_home["Home Page<br/>[index.php]"]
  node_catalog["Product Catalog<br/>[products.php]"]
  node_product_detail["Product Details"]
  node_customer_auth["Customer Accounts<br/>[register.php]"]
  node_account["Account History<br/>[account.php]"]
end

subgraph group_commerce["Purchase Lifecycle"]
  node_cart["Shopping Cart<br/>[cart.php]"]
  node_checkout["Checkout<br/>[checkout.php]"]
  node_order_tracking["Order Tracking<br/>[orders.php]"]
  node_confirmation["Order Confirmation"]
end

subgraph group_admin["Administration"]
  node_admin_auth["Admin Authentication<br/>[login.php]"]
  node_dashboard["Dashboard Analytics<br/>[index.php]"]
  node_product_admin["Product Management<br/>[add-product.php]"]
  node_category_admin["Category Management<br/>[categories.php]"]
  node_order_admin["Order Management<br/>[orders.php]"]
  node_customer_directory["Customer Directory<br/>[customers.php]"]
end

subgraph group_shared["Shared Services"]
  node_mysql[("MySQL Database")]
  node_db_connection["Database Connection<br/>[database.php]"]
  node_helpers["Session and Helpers<br/>[functions.php]"]
  node_customer_guard["Customer Session Guard<br/>[auth.php]"]
  node_admin_guard["Admin Session Guard<br/>[admin-auth.php]"]
end

node_customer(("Customer"))
node_admin_user(("Administrator"))

node_customer -->|"browses"| node_home
node_home -->|"links to"| node_catalog
node_home -->|"queries featured items"| node_mysql
node_catalog -->|"queries products"| node_mysql
node_catalog -->|"opens details"| node_product_detail
node_product_detail -->|"posts add item"| node_cart
node_customer -->|"registers or signs in"| node_customer_auth
node_customer_auth -->|"persists accounts"| node_mysql
node_customer_auth -->|"uses customer session"| node_customer_guard
node_customer -->|"manages items"| node_cart
node_cart -->|"reads stock and products"| node_mysql
node_cart -->|"proceeds to checkout"| node_checkout
node_checkout -->|"creates order and updates stock"| node_mysql
node_checkout -->|"requires customer login"| node_customer_guard
node_checkout -->|"confirms purchase"| node_confirmation
node_customer -->|"views orders"| node_order_tracking
node_order_tracking -->|"reads order history"| node_mysql
node_account -->|"shows order history"| node_mysql
node_admin_user -->|"signs in"| node_admin_auth
node_admin_auth -->|"uses admin session"| node_admin_guard
node_admin_user -->|"views analytics"| node_dashboard
node_dashboard -->|"queries metrics and orders"| node_mysql
node_admin_user -->|"manages products"| node_product_admin
node_product_admin -->|"updates product listings"| node_mysql
node_admin_user -->|"manages categories"| node_category_admin
node_category_admin -->|"updates categories"| node_mysql
node_admin_user -->|"tracks orders"| node_order_admin
node_order_admin -->|"reads and updates statuses"| node_mysql
node_admin_user -->|"views customers"| node_customer_directory
node_customer_directory -->|"reads customer accounts"| node_mysql
node_home -->|"renders product cards"| node_helpers
node_db_connection -->|"opens connection"| node_mysql
node_cart -->|"loads connection"| node_db_connection
node_dashboard -->|"loads connection"| node_db_connection
node_admin_guard -->|"loads shared helpers"| node_helpers

click node_home "https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/index.php"
click node_catalog "https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/products.php"
click node_product_detail "https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/product-details.php"
click node_customer_auth "https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/register.php"
click node_account "https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/account.php"
click node_cart "https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/cart.php"
click node_checkout "https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/checkout.php"
click node_order_tracking "https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/orders.php"
click node_confirmation "https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/order-confirmation.php"
click node_admin_auth "https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/admin/login.php"
click node_dashboard "https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/admin/index.php"
click node_product_admin "https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/admin/add-product.php"
click node_category_admin "https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/admin/categories.php"
click node_order_admin "https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/admin/orders.php"
click node_customer_directory "https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/admin/customers.php"
click node_db_connection "https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/config/database.php"
click node_helpers "https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/includes/functions.php"
click node_customer_guard "https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/includes/auth.php"
click node_admin_guard "https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/admin/includes/admin-auth.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_home,node_catalog,node_product_detail,node_customer_auth,node_account toneBlue
class node_cart,node_checkout,node_order_tracking,node_confirmation toneAmber
class node_admin_auth,node_dashboard,node_product_admin,node_category_admin,node_order_admin,node_customer_directory toneMint
class node_mysql,node_db_connection,node_helpers,node_customer_guard,node_admin_guard toneRose
class node_customer,node_admin_user toneIndigo
```

## Components

### Customer Storefront

- [Home Page](https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/index.php): `index.php`
- [Product Catalog](https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/products.php): `products.php`
- [Product Details](https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/product-details.php): `product-details.php`
- [Customer Accounts](https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/register.php): `register.php`
- [Account History](https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/account.php): `account.php`

### Purchase Lifecycle

- [Shopping Cart](https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/cart.php): `cart.php`
- [Checkout](https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/checkout.php): `checkout.php`
- [Order Tracking](https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/orders.php): `orders.php`
- [Order Confirmation](https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/order-confirmation.php): `order-confirmation.php`

### Administration

- [Admin Authentication](https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/admin/login.php): `admin/login.php`
- [Dashboard Analytics](https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/admin/index.php): `admin/index.php`
- [Product Management](https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/admin/add-product.php): `admin/add-product.php`
- [Category Management](https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/admin/categories.php): `admin/categories.php`
- [Order Management](https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/admin/orders.php): `admin/orders.php`
- [Customer Directory](https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/admin/customers.php): `admin/customers.php`

### Shared Services

- **MySQL Database**
- [Database Connection](https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/config/database.php): `config/database.php`
- [Session and Helpers](https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/includes/functions.php): `includes/functions.php`
- [Customer Session Guard](https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/includes/auth.php): `includes/auth.php`
- [Admin Session Guard](https://github.com/xnightm4re-cse/shopeasy-ecommerce/blob/main/admin/includes/admin-auth.php): `admin/includes/admin-auth.php`

### Other components

- **Customer**
- **Administrator**

## Connections

- Customer → Home Page: browses (evidence: `README.md`)
- Home Page → Product Catalog: links to (evidence: `index.php`)
- Home Page → MySQL Database: queries featured items (evidence: `index.php`)
- Product Catalog → MySQL Database: queries products (evidence: `README.md`)
- Product Catalog → Product Details: opens details
- Product Details → Shopping Cart: posts add item (evidence: `README.md`)
- Customer → Customer Accounts: registers or signs in (evidence: `README.md`)
- Customer Accounts → MySQL Database: persists accounts (evidence: `README.md`)
- Customer Accounts → Customer Session Guard: uses customer session (evidence: `README.md`)
- Customer → Shopping Cart: manages items (evidence: `cart.php`)
- Shopping Cart → MySQL Database: reads stock and products (evidence: `cart.php`)
- Shopping Cart → Checkout: proceeds to checkout (evidence: `cart.php`)
- Checkout → MySQL Database: creates order and updates stock (evidence: `README.md`)
- Checkout → Customer Session Guard: requires customer login (evidence: `README.md`)
- Checkout → Order Confirmation: confirms purchase (evidence: `README.md`)
- Customer → Order Tracking: views orders (evidence: `README.md`)
- Order Tracking → MySQL Database: reads order history (evidence: `README.md`)
- Account History → MySQL Database: shows order history (evidence: `README.md`)
- Administrator → Admin Authentication: signs in (evidence: `README.md`)
- Admin Authentication → Admin Session Guard: uses admin session (evidence: `admin/includes/admin-auth.php`)
- Administrator → Dashboard Analytics: views analytics (evidence: `README.md`)
- Dashboard Analytics → MySQL Database: queries metrics and orders (evidence: `admin/index.php`)
- Administrator → Product Management: manages products (evidence: `README.md`)
- Product Management → MySQL Database: updates product listings (evidence: `README.md`)
- Administrator → Category Management: manages categories (evidence: `README.md`)
- Category Management → MySQL Database: updates categories (evidence: `README.md`)
- Administrator → Order Management: tracks orders (evidence: `README.md`)
- Order Management → MySQL Database: reads and updates statuses (evidence: `admin/orders.php`)
- Administrator → Customer Directory: views customers (evidence: `README.md`)
- Customer Directory → MySQL Database: reads customer accounts (evidence: `README.md`)
- Home Page → Session and Helpers: renders product cards (evidence: `index.php`)
- Database Connection → MySQL Database: opens connection (evidence: `config/database.php`)
- Shopping Cart → Database Connection: loads connection (evidence: `cart.php`)
- Dashboard Analytics → Database Connection: loads connection (evidence: `admin/index.php`)
- Admin Session Guard → Session and Helpers: loads shared helpers (evidence: `admin/includes/admin-auth.php`)
