# vozhakov/shop architecture

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

- Interactive diagram: https://gitdiagram.com/vozhakov/shop
- Repository: https://github.com/vozhakov/shop

## Overview

This is a PHP/MySQL MVC storefront. A visitor browses categories and products, adds items to a session-backed cart, then submits an order; registered users can manage their account and view purchase history. Administrators manage products and users and review monthly sales statistics. The graph follows the documented capabilities and the sampled routing, controller, cart, and product-model code. Several controllers and domain models were not excerpted, so their documented feature links are shown as unverified rather than inferred call chains.

Main entry points: [`controllers/CartController.php`](https://github.com/vozhakov/shop/blob/master/controllers/CartController.php) (Cart workflow), [`core/View.php`](https://github.com/vozhakov/shop/blob/master/core/View.php) (View rendering), [`models/Product_model.php`](https://github.com/vozhakov/shop/blob/master/models/Product_model.php) (Product data), [`models/User_model.php`](https://github.com/vozhakov/shop/blob/master/models/User_model.php) (User accounts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Request runtime"]
  node_router["Route dispatch<br/>[Router.php]"]
  node_controller["Controller base<br/>[Controller.php]"]
  node_view["View rendering<br/>[View.php]"]
end

subgraph group_storefront["Storefront"]
  node_catalog["Catalog browsing"]
  node_catalog_views["Catalog pages"]
  node_product_detail["Product detail"]
  node_product_view["Product page<br/>[view_view.php]"]
  node_categories["Category data<br/>[Category_model.php]"]
  node_products["Product data<br/>[Product_model.php]"]
end

subgraph group_commerce["Cart and orders"]
  node_cart_controller["Cart workflow<br/>[CartController.php]"]
  node_cart_state["Session cart<br/>[Cart.php]"]
  node_orders["Order history and save<br/>[Order_model.php]"]
end

subgraph group_identity["Accounts"]
  node_cabinet["Account cabinet"]
  node_user_controller["Login and registration<br/>[UserController.php]"]
  node_users["User accounts<br/>[User_model.php]"]
end

subgraph group_admin["Administration"]
  node_admin_products["Product management"]
  node_admin_users["User administration"]
  node_admin_sales["Sales statistics"]
  node_admin_views["Admin pages"]
end

node_visitor(("Visitor"))
node_mysql[("MySQL database<br/>[dbConn.php]")]

node_visitor -->|"requests"| node_router
node_router -->|"dispatches"| node_controller
node_controller -->|"creates"| node_view
node_catalog -->|"loads categories"| node_categories
node_catalog -->|"loads products"| node_products
node_catalog -.->|"renders"| node_catalog_views
node_product_detail -.->|"loads product"| node_products
node_product_detail -.->|"renders"| node_product_view
node_cart_controller -->|"reads and updates"| node_cart_state
node_cart_controller -->|"loads cart products"| node_products
node_cart_controller -->|"loads categories"| node_categories
node_cart_controller -->|"loads customer"| node_users
node_cart_controller -->|"saves order"| node_orders
node_cart_controller -->|"renders"| node_view
node_cabinet -->|"loads and updates"| node_users
node_cabinet -->|"loads history"| node_orders
node_cabinet -->|"renders"| node_view
node_user_controller -->|"authenticates and registers"| node_users
node_user_controller -->|"renders"| node_view
node_admin_products -->|"manages products"| node_products
node_admin_products -->|"loads categories"| node_categories
node_admin_products -->|"renders"| node_view
node_admin_users -->|"manages users"| node_users
node_admin_users -->|"renders"| node_view
node_admin_sales -.->|"reviews sales"| node_orders
node_admin_sales -.->|"renders"| node_view
node_admin_products -.->|"uses admin pages"| node_admin_views
node_products -->|"queries"| node_mysql
node_users -.->|"persists account data"| node_mysql
node_orders -.->|"persists orders"| node_mysql

click node_router "https://github.com/vozhakov/shop/blob/master/core/Router.php"
click node_controller "https://github.com/vozhakov/shop/blob/master/core/Controller.php"
click node_view "https://github.com/vozhakov/shop/blob/master/core/View.php"
click node_catalog "https://github.com/vozhakov/shop/blob/master/controllers/CatalogController.php"
click node_catalog_views "https://github.com/vozhakov/shop/tree/master/views/catalog"
click node_product_detail "https://github.com/vozhakov/shop/blob/master/controllers/ProductController.php"
click node_product_view "https://github.com/vozhakov/shop/blob/master/views/product/view_view.php"
click node_categories "https://github.com/vozhakov/shop/blob/master/models/Category_model.php"
click node_products "https://github.com/vozhakov/shop/blob/master/models/Product_model.php"
click node_cart_controller "https://github.com/vozhakov/shop/blob/master/controllers/CartController.php"
click node_cart_state "https://github.com/vozhakov/shop/blob/master/lib/Cart.php"
click node_orders "https://github.com/vozhakov/shop/blob/master/models/Order_model.php"
click node_cabinet "https://github.com/vozhakov/shop/blob/master/controllers/CabinetController.php"
click node_user_controller "https://github.com/vozhakov/shop/blob/master/controllers/UserController.php"
click node_users "https://github.com/vozhakov/shop/blob/master/models/User_model.php"
click node_admin_products "https://github.com/vozhakov/shop/blob/master/controllers/AdminProductController.php"
click node_admin_users "https://github.com/vozhakov/shop/blob/master/controllers/AdminUserController.php"
click node_admin_sales "https://github.com/vozhakov/shop/blob/master/controllers/AdminSaleController.php"
click node_admin_views "https://github.com/vozhakov/shop/tree/master/views/admin"
click node_mysql "https://github.com/vozhakov/shop/blob/master/lib/dbConn.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_router,node_controller,node_view toneBlue
class node_catalog,node_catalog_views,node_product_detail,node_product_view,node_categories,node_products,node_mysql toneAmber
class node_cart_controller,node_cart_state,node_orders toneMint
class node_cabinet,node_user_controller,node_users toneRose
class node_admin_products,node_admin_users,node_admin_sales,node_admin_views,node_visitor toneIndigo
```

## Components

### Request runtime

- [Route dispatch](https://github.com/vozhakov/shop/blob/master/core/Router.php): `core/Router.php`
- [Controller base](https://github.com/vozhakov/shop/blob/master/core/Controller.php): `core/Controller.php`
- [View rendering](https://github.com/vozhakov/shop/blob/master/core/View.php): `core/View.php`

### Storefront

- [Catalog browsing](https://github.com/vozhakov/shop/blob/master/controllers/CatalogController.php): `controllers/CatalogController.php`
- [Catalog pages](https://github.com/vozhakov/shop/tree/master/views/catalog): `views/catalog`
- [Product detail](https://github.com/vozhakov/shop/blob/master/controllers/ProductController.php): `controllers/ProductController.php`
- [Product page](https://github.com/vozhakov/shop/blob/master/views/product/view_view.php): `views/product/view_view.php`
- [Category data](https://github.com/vozhakov/shop/blob/master/models/Category_model.php): `models/Category_model.php`
- [Product data](https://github.com/vozhakov/shop/blob/master/models/Product_model.php): `models/Product_model.php`

### Cart and orders

- [Cart workflow](https://github.com/vozhakov/shop/blob/master/controllers/CartController.php): `controllers/CartController.php`
- [Session cart](https://github.com/vozhakov/shop/blob/master/lib/Cart.php): `lib/Cart.php`
- [Order history and save](https://github.com/vozhakov/shop/blob/master/models/Order_model.php): `models/Order_model.php`

### Accounts

- [Account cabinet](https://github.com/vozhakov/shop/blob/master/controllers/CabinetController.php): `controllers/CabinetController.php`
- [Login and registration](https://github.com/vozhakov/shop/blob/master/controllers/UserController.php): `controllers/UserController.php`
- [User accounts](https://github.com/vozhakov/shop/blob/master/models/User_model.php): `models/User_model.php`

### Administration

- [Product management](https://github.com/vozhakov/shop/blob/master/controllers/AdminProductController.php): `controllers/AdminProductController.php`
- [User administration](https://github.com/vozhakov/shop/blob/master/controllers/AdminUserController.php): `controllers/AdminUserController.php`
- [Sales statistics](https://github.com/vozhakov/shop/blob/master/controllers/AdminSaleController.php): `controllers/AdminSaleController.php`
- [Admin pages](https://github.com/vozhakov/shop/tree/master/views/admin): `views/admin`

### Other components

- **Visitor**
- [MySQL database](https://github.com/vozhakov/shop/blob/master/lib/dbConn.php): `lib/dbConn.php`

## Connections

- Visitor → Route dispatch: requests
- Route dispatch → Controller base: dispatches (evidence: `core/Router.php`)
- Controller base → View rendering: creates (evidence: `core/Controller.php`)
- Catalog browsing → Category data: loads categories (evidence: `controllers/CatalogController.php`)
- Catalog browsing → Product data: loads products (evidence: `controllers/CatalogController.php`)
- Catalog browsing → Catalog pages: renders
- Product detail → Product data: loads product
- Product detail → Product page: renders
- Cart workflow → Session cart: reads and updates (evidence: `controllers/CartController.php`)
- Cart workflow → Product data: loads cart products (evidence: `controllers/CartController.php`)
- Cart workflow → Category data: loads categories (evidence: `controllers/CartController.php`)
- Cart workflow → User accounts: loads customer (evidence: `controllers/CartController.php`)
- Cart workflow → Order history and save: saves order (evidence: `controllers/CartController.php`)
- Cart workflow → View rendering: renders (evidence: `controllers/CartController.php`)
- Account cabinet → User accounts: loads and updates (evidence: `controllers/CabinetController.php`)
- Account cabinet → Order history and save: loads history (evidence: `controllers/CabinetController.php`)
- Account cabinet → View rendering: renders (evidence: `controllers/CabinetController.php`)
- Login and registration → User accounts: authenticates and registers (evidence: `controllers/UserController.php`)
- Login and registration → View rendering: renders (evidence: `controllers/UserController.php`)
- Product management → Product data: manages products (evidence: `controllers/AdminProductController.php`)
- Product management → Category data: loads categories (evidence: `controllers/AdminProductController.php`)
- Product management → View rendering: renders (evidence: `controllers/AdminProductController.php`)
- User administration → User accounts: manages users (evidence: `controllers/AdminUserController.php`)
- User administration → View rendering: renders (evidence: `controllers/AdminUserController.php`)
- Sales statistics → Order history and save: reviews sales
- Sales statistics → View rendering: renders
- Product management → Admin pages: uses admin pages
- Product data → MySQL database: queries (evidence: `models/Product_model.php`)
- User accounts → MySQL database: persists account data
- Order history and save → MySQL database: persists orders
