# davidhung-2777/project-ecommerce architecture

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

- Interactive diagram: https://gitdiagram.com/davidhung-2777/project-ecommerce
- Repository: https://github.com/davidhung-2777/project-ecommerce

## Overview

DecorNest is a PHP MVC furniture-commerce platform serving retail customers and B2B buyers, with an admin back office. The main customer flow routes product browsing and cart actions through checkout, which creates an order and hands payment handling to payment controllers and gateways. Separate branches cover B2B quotes, accounts, shipping, vouchers, and administration. Edges are limited to relationships shown in excerpts, the SOURCE INDEX, or README; some product capabilities are documented but their detailed wiring was not sampled.

Main entry points: [`app/core/App.php`](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/core/App.php) (App Router), [`app/controllers/CheckoutController.php`](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/controllers/CheckoutController.php) (Checkout), [`app/controllers/AdminController.php`](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/controllers/AdminController.php) (Admin Management), [`app/models/OrderModel.php`](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/models/OrderModel.php) (Orders)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["MVC Runtime"]
  node_entry["Web Entry<br/>[index.php]"]
  node_app["App Router<br/>[App.php]"]
  node_router["Route Dispatch<br/>[Router.php]"]
  node_controller["Controller Base<br/>[Controller.php]"]
  node_model["Model Base<br/>[Model.php]"]
  node_database["Database Access<br/>[Database.php]"]
  node_auth["Authentication<br/>[Auth.php]"]
  node_views["Application Views"]
end

subgraph group_commerce["Customer Commerce"]
  node_catalog["Product Catalog"]
  node_products["Products<br/>[ProductModel.php]"]
  node_categories["Categories<br/>[CategoryModel.php]"]
  node_cart["Cart<br/>[CartController.php]"]
  node_cartdata["Cart Data<br/>[CartModel.php]"]
  node_checkout["Checkout"]
  node_orders["Orders<br/>[OrderModel.php]"]
  node_payments["Payment Handling"]
  node_paymentdata["Payment Records<br/>[PaymentModel.php]"]
  node_quotes["B2B Quotes"]
  node_quotedata["Quote Records<br/>[QuoteModel.php]"]
  node_accounts["User Accounts<br/>[UserController.php]"]
  node_users["User Records<br/>[UserModel.php]"]
  node_voucher["Voucher Rules<br/>[VoucherService.php]"]
end

subgraph group_operations["Admin Operations"]
  node_adminops["Admin Management"]
  node_dashboard["Admin Dashboard"]
end

subgraph group_integrations["External Services"]
  node_paymentmethods["Payment Methods"]
  node_shipping["Shipping Service"]
  node_ghn{{"GHN API"}}
  node_sepay["SePay Webhook"]
  node_mysql[("MySQL")]
end

node_customer(("Customer"))
node_admin(("Admin"))

node_customer -->|"requests pages"| node_entry
node_admin -->|"requests admin"| node_entry
node_entry -->|"starts"| node_app
node_app -->|"configures routes"| node_router
node_app -->|"routes to"| node_catalog
node_app -->|"routes to"| node_cart
node_app -->|"routes to"| node_checkout
node_app -->|"routes to"| node_payments
node_app -->|"routes to"| node_quotes
node_app -->|"routes to"| node_accounts
node_app -->|"routes to"| node_adminops
node_app -->|"routes to"| node_sepay
node_catalog -->|"queries"| node_products
node_catalog -->|"queries"| node_categories
node_cart -->|"manages"| node_cartdata
node_cart -->|"looks up"| node_products
node_checkout -->|"loads cart"| node_cartdata
node_checkout -->|"creates order"| node_orders
node_checkout -->|"calculates fee"| node_shipping
node_checkout -->|"validates voucher"| node_voucher
node_checkout -.->|"continues payment"| node_payments
node_payments -->|"updates status"| node_orders
node_payments -->|"records payment"| node_paymentdata
node_payments -->|"dispatches method"| node_paymentmethods
node_sepay -->|"updates order"| node_orders
node_sepay -->|"updates payment"| node_paymentdata
node_quotes -->|"manages quotes"| node_quotedata
node_quotes -->|"uses product data"| node_products
node_accounts -->|"authenticates and manages"| node_users
node_accounts -->|"loads customer orders"| node_orders
node_adminops -->|"manages products"| node_products
node_adminops -->|"manages orders"| node_orders
node_adminops -->|"manages quotes"| node_quotedata
node_adminops -->|"manages users"| node_users
node_adminops -->|"extends"| node_controller
node_dashboard -->|"reads statistics"| node_orders
node_dashboard -->|"reads statistics"| node_quotedata
node_dashboard -->|"reads statistics"| node_users
node_controller -->|"renders"| node_views
node_model -->|"uses"| node_database
node_auth -->|"checks identity"| node_users
node_database -->|"queries"| node_mysql
node_shipping -->|"calls API"| node_ghn
node_paymentmethods -.->|"supports VietQR webhook"| node_sepay

click node_entry "https://github.com/davidhung-2777/project-ecommerce/blob/main/public/index.php"
click node_app "https://github.com/davidhung-2777/project-ecommerce/blob/main/app/core/App.php"
click node_router "https://github.com/davidhung-2777/project-ecommerce/blob/main/app/core/Router.php"
click node_controller "https://github.com/davidhung-2777/project-ecommerce/blob/main/app/core/Controller.php"
click node_model "https://github.com/davidhung-2777/project-ecommerce/blob/main/app/core/Model.php"
click node_database "https://github.com/davidhung-2777/project-ecommerce/blob/main/app/core/Database.php"
click node_auth "https://github.com/davidhung-2777/project-ecommerce/blob/main/app/core/Auth.php"
click node_catalog "https://github.com/davidhung-2777/project-ecommerce/blob/main/app/controllers/ProductController.php"
click node_products "https://github.com/davidhung-2777/project-ecommerce/blob/main/app/models/ProductModel.php"
click node_categories "https://github.com/davidhung-2777/project-ecommerce/blob/main/app/models/CategoryModel.php"
click node_cart "https://github.com/davidhung-2777/project-ecommerce/blob/main/app/controllers/CartController.php"
click node_cartdata "https://github.com/davidhung-2777/project-ecommerce/blob/main/app/models/CartModel.php"
click node_checkout "https://github.com/davidhung-2777/project-ecommerce/blob/main/app/controllers/CheckoutController.php"
click node_orders "https://github.com/davidhung-2777/project-ecommerce/blob/main/app/models/OrderModel.php"
click node_payments "https://github.com/davidhung-2777/project-ecommerce/blob/main/app/controllers/PaymentController.php"
click node_paymentdata "https://github.com/davidhung-2777/project-ecommerce/blob/main/app/models/PaymentModel.php"
click node_paymentmethods "https://github.com/davidhung-2777/project-ecommerce/tree/main/app/services/payment"
click node_quotes "https://github.com/davidhung-2777/project-ecommerce/blob/main/app/controllers/QuoteController.php"
click node_quotedata "https://github.com/davidhung-2777/project-ecommerce/blob/main/app/models/QuoteModel.php"
click node_accounts "https://github.com/davidhung-2777/project-ecommerce/blob/main/app/controllers/UserController.php"
click node_users "https://github.com/davidhung-2777/project-ecommerce/blob/main/app/models/UserModel.php"
click node_voucher "https://github.com/davidhung-2777/project-ecommerce/blob/main/app/services/VoucherService.php"
click node_shipping "https://github.com/davidhung-2777/project-ecommerce/blob/main/app/services/GhnShippingService.php"
click node_sepay "https://github.com/davidhung-2777/project-ecommerce/blob/main/app/controllers/WebhookController.php"
click node_adminops "https://github.com/davidhung-2777/project-ecommerce/blob/main/app/controllers/AdminController.php"
click node_dashboard "https://github.com/davidhung-2777/project-ecommerce/blob/main/app/controllers/DashboardController.php"
click node_views "https://github.com/davidhung-2777/project-ecommerce/tree/main/app/views"

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_entry,node_app,node_router,node_controller,node_model,node_database,node_auth,node_views toneBlue
class node_catalog,node_products,node_categories,node_cart,node_cartdata,node_checkout,node_orders,node_payments,node_paymentdata,node_quotes,node_quotedata,node_accounts,node_users,node_voucher toneAmber
class node_adminops,node_dashboard toneMint
class node_paymentmethods,node_shipping,node_ghn,node_sepay,node_mysql toneRose
class node_customer,node_admin toneIndigo
```

## Components

### MVC Runtime

- [Web Entry](https://github.com/davidhung-2777/project-ecommerce/blob/main/public/index.php): `public/index.php`
- [App Router](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/core/App.php): `app/core/App.php`
- [Route Dispatch](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/core/Router.php): `app/core/Router.php`
- [Controller Base](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/core/Controller.php): `app/core/Controller.php`
- [Model Base](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/core/Model.php): `app/core/Model.php`
- [Database Access](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/core/Database.php): `app/core/Database.php`
- [Authentication](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/core/Auth.php): `app/core/Auth.php`
- [Application Views](https://github.com/davidhung-2777/project-ecommerce/tree/main/app/views): `app/views`

### Customer Commerce

- [Product Catalog](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/controllers/ProductController.php): `app/controllers/ProductController.php`
- [Products](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/models/ProductModel.php): `app/models/ProductModel.php`
- [Categories](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/models/CategoryModel.php): `app/models/CategoryModel.php`
- [Cart](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/controllers/CartController.php): `app/controllers/CartController.php`
- [Cart Data](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/models/CartModel.php): `app/models/CartModel.php`
- [Checkout](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/controllers/CheckoutController.php): `app/controllers/CheckoutController.php`
- [Orders](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/models/OrderModel.php): `app/models/OrderModel.php`
- [Payment Handling](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/controllers/PaymentController.php): `app/controllers/PaymentController.php`
- [Payment Records](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/models/PaymentModel.php): `app/models/PaymentModel.php`
- [B2B Quotes](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/controllers/QuoteController.php): `app/controllers/QuoteController.php`
- [Quote Records](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/models/QuoteModel.php): `app/models/QuoteModel.php`
- [User Accounts](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/controllers/UserController.php): `app/controllers/UserController.php`
- [User Records](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/models/UserModel.php): `app/models/UserModel.php`
- [Voucher Rules](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/services/VoucherService.php): `app/services/VoucherService.php`

### Admin Operations

- [Admin Management](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/controllers/AdminController.php): `app/controllers/AdminController.php`
- [Admin Dashboard](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/controllers/DashboardController.php): `app/controllers/DashboardController.php`

### External Services

- [Payment Methods](https://github.com/davidhung-2777/project-ecommerce/tree/main/app/services/payment): `app/services/payment`
- [Shipping Service](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/services/GhnShippingService.php): `app/services/GhnShippingService.php`
- **GHN API**
- [SePay Webhook](https://github.com/davidhung-2777/project-ecommerce/blob/main/app/controllers/WebhookController.php): `app/controllers/WebhookController.php`
- **MySQL**

### Other components

- **Customer**
- **Admin**

## Connections

- Customer → Web Entry: requests pages (evidence: `README.md`)
- Admin → Web Entry: requests admin (evidence: `README.md`)
- Web Entry → App Router: starts (evidence: `public/index.php`)
- App Router → Route Dispatch: configures routes (evidence: `app/core/App.php`)
- App Router → Product Catalog: routes to (evidence: `app/core/App.php`)
- App Router → Cart: routes to (evidence: `app/core/App.php`)
- App Router → Checkout: routes to (evidence: `app/core/App.php`)
- App Router → Payment Handling: routes to (evidence: `app/core/App.php`)
- App Router → B2B Quotes: routes to (evidence: `app/core/App.php`)
- App Router → User Accounts: routes to (evidence: `app/core/App.php`)
- App Router → Admin Management: routes to (evidence: `app/core/App.php`)
- App Router → SePay Webhook: routes to (evidence: `app/core/App.php`)
- Product Catalog → Products: queries (evidence: `app/controllers/ProductController.php`)
- Product Catalog → Categories: queries (evidence: `app/controllers/ProductController.php`)
- Cart → Cart Data: manages (evidence: `app/controllers/CartController.php`)
- Cart → Products: looks up (evidence: `app/controllers/CartController.php`)
- Checkout → Cart Data: loads cart (evidence: `app/controllers/CheckoutController.php`)
- Checkout → Orders: creates order (evidence: `app/controllers/CheckoutController.php`)
- Checkout → Shipping Service: calculates fee (evidence: `app/controllers/CheckoutController.php`)
- Checkout → Voucher Rules: validates voucher (evidence: `app/controllers/CheckoutController.php`)
- Checkout → Payment Handling: continues payment
- Payment Handling → Orders: updates status (evidence: `app/controllers/PaymentController.php`)
- Payment Handling → Payment Records: records payment (evidence: `app/controllers/PaymentController.php`)
- Payment Handling → Payment Methods: dispatches method (evidence: `app/controllers/PaymentController.php`)
- SePay Webhook → Orders: updates order (evidence: `app/controllers/WebhookController.php`)
- SePay Webhook → Payment Records: updates payment (evidence: `app/controllers/WebhookController.php`)
- B2B Quotes → Quote Records: manages quotes (evidence: `app/controllers/QuoteController.php`)
- B2B Quotes → Products: uses product data (evidence: `app/controllers/QuoteController.php`)
- User Accounts → User Records: authenticates and manages (evidence: `app/controllers/UserController.php`)
- User Accounts → Orders: loads customer orders (evidence: `app/controllers/UserController.php`)
- Admin Management → Products: manages products (evidence: `app/controllers/AdminController.php`)
- Admin Management → Orders: manages orders (evidence: `app/controllers/AdminController.php`)
- Admin Management → Quote Records: manages quotes (evidence: `app/controllers/AdminController.php`)
- Admin Management → User Records: manages users (evidence: `app/controllers/AdminController.php`)
- Admin Management → Controller Base: extends (evidence: `app/controllers/AdminController.php`)
- Admin Dashboard → Orders: reads statistics (evidence: `app/controllers/DashboardController.php`)
- Admin Dashboard → Quote Records: reads statistics (evidence: `app/controllers/DashboardController.php`)
- Admin Dashboard → User Records: reads statistics (evidence: `app/controllers/DashboardController.php`)
- Controller Base → Application Views: renders (evidence: `app/core/Controller.php`)
- Model Base → Database Access: uses (evidence: `app/core/Model.php`)
- Authentication → User Records: checks identity (evidence: `app/core/Auth.php`)
- Database Access → MySQL: queries (evidence: `app/core/Database.php`)
- Shipping Service → GHN API: calls API (evidence: `app/services/GhnShippingService.php`)
- Payment Methods → SePay Webhook: supports VietQR webhook (evidence: `app/controllers/WebhookController.php`)
