# quoctan342/sales-website-php architecture

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

- Interactive diagram: https://gitdiagram.com/quoctan342/sales-website-php
- Repository: https://github.com/quoctan342/sales-website-php

## Overview

This is a PHP/MySQL shop. The main customer-facing workflow covers product browsing and search, cart actions and checkout, followed by account and order access; the separate admin area manages catalog data, orders and accounts. The graph preserves these documented subsystems, but the excerpts do not expose checkout persistence or several unsampled route implementations, so those internal relationships are not asserted.

Main entry points: [`Source/adminpanel/index.php`](https://github.com/quoctan342/sales-website-php/blob/main/Source/adminpanel/index.php) (Admin dashboard), [`Source/giohang/index.php`](https://github.com/quoctan342/sales-website-php/blob/main/Source/giohang/index.php) (Cart router), [`Source/SanPham/index.php`](https://github.com/quoctan342/sales-website-php/blob/main/Source/SanPham/index.php) (Catalog router), [`Source/db.php`](https://github.com/quoctan342/sales-website-php/blob/main/Source/db.php) (MySQL database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer shop"]
  node_catalog_router["Catalog router<br/>[index.php]"]
  node_product_detail["Product detail<br/>[sanpham.php]"]
  node_product_listing["Product listings<br/>[dssp.php]"]
  node_search["Product search<br/>[timkiem.php]"]
  node_cart_router["Cart router<br/>[index.php]"]
  node_cart_view["Cart view<br/>[giohang.php]"]
  node_cart_actions["Cart actions"]
  node_checkout["Checkout<br/>[thanhtoan.php]"]
end

subgraph group_account["Accounts and orders"]
  node_account_router["Account router<br/>[index.php]"]
  node_account_profile["Account profile<br/>[taikhoan.php]"]
  node_account_update["Profile update<br/>[capnhat.php]"]
  node_order_router["Order router<br/>[index.php]"]
  node_order_list["Order history<br/>[dsdh.php]"]
  node_order_detail["Order details<br/>[chitiet.php]"]
end

subgraph group_admin["Administration"]
  node_admin_router["Admin dashboard<br/>[index.php]"]
  node_product_admin["Product management"]
  node_category_admin["Category management"]
  node_brand_admin["Manufacturer management"]
  node_order_admin["Order management"]
  node_user_admin["Account management"]
end

subgraph group_shared["Shared runtime"]
  node_public_header["Shop header<br/>[header.php]"]
  node_admin_header["Admin header<br/>[header.php]"]
  node_database[("MySQL database<br/>[db.php]")]
end

node_shopper(("Shopper"))

node_shopper -.->|"browses"| node_catalog_router
node_shopper -.->|"manages cart"| node_cart_router
node_catalog_router -->|"dispatches"| node_product_detail
node_catalog_router -->|"dispatches"| node_product_listing
node_cart_router -->|"dispatches"| node_cart_view
node_cart_router -->|"dispatches"| node_cart_actions
node_cart_router -->|"dispatches"| node_checkout
node_account_router -->|"dispatches"| node_account_profile
node_account_router -->|"dispatches"| node_account_update
node_order_router -->|"dispatches"| node_order_list
node_order_router -->|"dispatches"| node_order_detail
node_public_header -->|"queries"| node_database
node_admin_header -->|"loads"| node_database
node_admin_router -->|"requires"| node_admin_header
node_admin_router -->|"dispatches"| node_product_admin
node_admin_router -->|"dispatches"| node_category_admin
node_admin_router -->|"dispatches"| node_brand_admin
node_admin_router -->|"dispatches"| node_order_admin
node_admin_router -->|"dispatches"| node_user_admin
node_product_admin -->|"inserts product"| node_database

click node_catalog_router "https://github.com/quoctan342/sales-website-php/blob/main/Source/SanPham/index.php"
click node_product_detail "https://github.com/quoctan342/sales-website-php/blob/main/Source/SanPham/sanpham.php"
click node_product_listing "https://github.com/quoctan342/sales-website-php/blob/main/Source/SanPham/dssp.php"
click node_search "https://github.com/quoctan342/sales-website-php/blob/main/Source/timkiem.php"
click node_cart_router "https://github.com/quoctan342/sales-website-php/blob/main/Source/giohang/index.php"
click node_cart_view "https://github.com/quoctan342/sales-website-php/blob/main/Source/giohang/giohang.php"
click node_cart_actions "https://github.com/quoctan342/sales-website-php/tree/main/Source/giohang"
click node_checkout "https://github.com/quoctan342/sales-website-php/blob/main/Source/giohang/thanhtoan.php"
click node_account_router "https://github.com/quoctan342/sales-website-php/blob/main/Source/taikhoan/index.php"
click node_account_profile "https://github.com/quoctan342/sales-website-php/blob/main/Source/taikhoan/taikhoan.php"
click node_account_update "https://github.com/quoctan342/sales-website-php/blob/main/Source/taikhoan/capnhat.php"
click node_order_router "https://github.com/quoctan342/sales-website-php/blob/main/Source/donhang/index.php"
click node_order_list "https://github.com/quoctan342/sales-website-php/blob/main/Source/donhang/dsdh.php"
click node_order_detail "https://github.com/quoctan342/sales-website-php/blob/main/Source/donhang/chitiet.php"
click node_admin_router "https://github.com/quoctan342/sales-website-php/blob/main/Source/adminpanel/index.php"
click node_product_admin "https://github.com/quoctan342/sales-website-php/tree/main/Source/qlySanPham"
click node_category_admin "https://github.com/quoctan342/sales-website-php/tree/main/Source/qlyLoaiSP"
click node_brand_admin "https://github.com/quoctan342/sales-website-php/tree/main/Source/qlyHangSX"
click node_order_admin "https://github.com/quoctan342/sales-website-php/tree/main/Source/qlyDonhang"
click node_user_admin "https://github.com/quoctan342/sales-website-php/tree/main/Source/qlyTaiKhoan"
click node_public_header "https://github.com/quoctan342/sales-website-php/blob/main/Source/header.php"
click node_admin_header "https://github.com/quoctan342/sales-website-php/blob/main/Source/adminpanel/header.php"
click node_database "https://github.com/quoctan342/sales-website-php/blob/main/Source/db.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_catalog_router,node_product_detail,node_product_listing,node_search,node_cart_router,node_cart_view,node_cart_actions,node_checkout toneBlue
class node_account_router,node_account_profile,node_account_update,node_order_router,node_order_list,node_order_detail toneAmber
class node_admin_router,node_product_admin,node_category_admin,node_brand_admin,node_order_admin,node_user_admin toneMint
class node_public_header,node_admin_header,node_database toneRose
class node_shopper toneIndigo
```

## Components

### Customer shop

- [Catalog router](https://github.com/quoctan342/sales-website-php/blob/main/Source/SanPham/index.php): `Source/SanPham/index.php`
- [Product detail](https://github.com/quoctan342/sales-website-php/blob/main/Source/SanPham/sanpham.php): `Source/SanPham/sanpham.php`
- [Product listings](https://github.com/quoctan342/sales-website-php/blob/main/Source/SanPham/dssp.php): `Source/SanPham/dssp.php`
- [Product search](https://github.com/quoctan342/sales-website-php/blob/main/Source/timkiem.php): `Source/timkiem.php`
- [Cart router](https://github.com/quoctan342/sales-website-php/blob/main/Source/giohang/index.php): `Source/giohang/index.php`
- [Cart view](https://github.com/quoctan342/sales-website-php/blob/main/Source/giohang/giohang.php): `Source/giohang/giohang.php`
- [Cart actions](https://github.com/quoctan342/sales-website-php/tree/main/Source/giohang): `Source/giohang`
- [Checkout](https://github.com/quoctan342/sales-website-php/blob/main/Source/giohang/thanhtoan.php): `Source/giohang/thanhtoan.php`

### Accounts and orders

- [Account router](https://github.com/quoctan342/sales-website-php/blob/main/Source/taikhoan/index.php): `Source/taikhoan/index.php`
- [Account profile](https://github.com/quoctan342/sales-website-php/blob/main/Source/taikhoan/taikhoan.php): `Source/taikhoan/taikhoan.php`
- [Profile update](https://github.com/quoctan342/sales-website-php/blob/main/Source/taikhoan/capnhat.php): `Source/taikhoan/capnhat.php`
- [Order router](https://github.com/quoctan342/sales-website-php/blob/main/Source/donhang/index.php): `Source/donhang/index.php`
- [Order history](https://github.com/quoctan342/sales-website-php/blob/main/Source/donhang/dsdh.php): `Source/donhang/dsdh.php`
- [Order details](https://github.com/quoctan342/sales-website-php/blob/main/Source/donhang/chitiet.php): `Source/donhang/chitiet.php`

### Administration

- [Admin dashboard](https://github.com/quoctan342/sales-website-php/blob/main/Source/adminpanel/index.php): `Source/adminpanel/index.php`
- [Product management](https://github.com/quoctan342/sales-website-php/tree/main/Source/qlySanPham): `Source/qlySanPham`
- [Category management](https://github.com/quoctan342/sales-website-php/tree/main/Source/qlyLoaiSP): `Source/qlyLoaiSP`
- [Manufacturer management](https://github.com/quoctan342/sales-website-php/tree/main/Source/qlyHangSX): `Source/qlyHangSX`
- [Order management](https://github.com/quoctan342/sales-website-php/tree/main/Source/qlyDonhang): `Source/qlyDonhang`
- [Account management](https://github.com/quoctan342/sales-website-php/tree/main/Source/qlyTaiKhoan): `Source/qlyTaiKhoan`

### Shared runtime

- [Shop header](https://github.com/quoctan342/sales-website-php/blob/main/Source/header.php): `Source/header.php`
- [Admin header](https://github.com/quoctan342/sales-website-php/blob/main/Source/adminpanel/header.php): `Source/adminpanel/header.php`
- [MySQL database](https://github.com/quoctan342/sales-website-php/blob/main/Source/db.php): `Source/db.php`

### Other components

- **Shopper**

## Connections

- Shopper → Catalog router: browses
- Shopper → Cart router: manages cart
- Catalog router → Product detail: dispatches (evidence: `Source/SanPham/index.php`)
- Catalog router → Product listings: dispatches (evidence: `Source/SanPham/index.php`)
- Cart router → Cart view: dispatches (evidence: `Source/giohang/index.php`)
- Cart router → Cart actions: dispatches (evidence: `Source/giohang/index.php`)
- Cart router → Checkout: dispatches (evidence: `Source/giohang/index.php`)
- Account router → Account profile: dispatches (evidence: `Source/taikhoan/index.php`)
- Account router → Profile update: dispatches (evidence: `Source/taikhoan/index.php`)
- Order router → Order history: dispatches (evidence: `Source/donhang/index.php`)
- Order router → Order details: dispatches (evidence: `Source/donhang/index.php`)
- Shop header → MySQL database: queries (evidence: `Source/header.php`)
- Admin header → MySQL database: loads (evidence: `Source/adminpanel/header.php`)
- Admin dashboard → Admin header: requires (evidence: `Source/adminpanel/index.php`)
- Admin dashboard → Product management: dispatches (evidence: `Source/qlySanPham/index.php`)
- Admin dashboard → Category management: dispatches (evidence: `Source/qlyLoaiSP/index.php`)
- Admin dashboard → Manufacturer management: dispatches (evidence: `Source/qlyHangSX/index.php`)
- Admin dashboard → Order management: dispatches (evidence: `Source/qlyDonhang/index.php`)
- Admin dashboard → Account management: dispatches (evidence: `Source/qlyTaiKhoan/index.php`)
- Product management → MySQL database: inserts product (evidence: `Source/qlySanPham/add.php`)
