# thieu2451220099/tranduythieu_24ct2_cnpm. architecture

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

- Interactive diagram: https://gitdiagram.com/thieu2451220099/tranduythieu_24ct2_cnpm.
- Repository: https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm.

## Overview

Thiệu_shop is a Spring Boot online store. Customers browse and search products, add size/color selections to a session cart, and submit an address and payment choice; order creation checks stock, saves order items, and reduces inventory. Customers can review or cancel eligible orders, while admins manage products and order statuses. Authentication, product browsing, cart handling, checkout, and administration are represented as separate stages. The excerpts show controller, service, and repository responsibilities; the README documents MySQL and payment options, but payment-processing internals were not sampled.

Main entry points: [`src/main/java/com/shop/repository/ProductRepository.java`](https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/repository/ProductRepository.java) (Product repository), [`src/main/java/com/shop/controller/AdminController.java`](https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/controller/AdminController.java) (Admin operations), [`src/main/java/com/shop/controller/OrderController.java`](https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/controller/OrderController.java) (Checkout and history), [`src/main/java/com/shop/service/OrderService.java`](https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/service/OrderService.java) (Order lifecycle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Storefront"]
  node_catalog["Catalog browsing"]
  node_cart["Session cart"]
  node_cart_view["Cart view<br/>[cart.html]"]
  node_product_view["Product pages"]
end

subgraph group_accounts["Accounts"]
  node_auth["Sign-in and registration"]
end

subgraph group_commerce["Orders"]
  node_checkout["Checkout and history"]
  node_order_service["Order lifecycle<br/>[OrderService.java]"]
  node_payment_options["COD and bank transfer<br/>[cart.html]"]
end

subgraph group_admin["Administration"]
  node_admin_controller["Admin operations"]
end

subgraph group_persistence["Persistence"]
  node_user_repo["User repository"]
  node_user_model["User records<br/>[User.java]"]
  node_order_repo["Order repository"]
  node_item_repo["Order-item repository"]
  node_order_model["Order records<br/>[Order.java]"]
  node_item_model["Order-item records<br/>[OrderItem.java]"]
  node_product_repo["Product repository"]
  node_product_model["Product and stock<br/>[Product.java]"]
  node_mysql[("MySQL store<br/>[shop_online.sql]")]
end

node_shopper(("Shopper"))
node_admin_actor(("Administrator"))

node_shopper -->|"browses"| node_catalog
node_catalog -->|"searches products"| node_product_repo
node_catalog -->|"renders"| node_product_view
node_shopper -->|"adds items"| node_cart
node_cart -->|"reads stock"| node_product_repo
node_cart -->|"renders"| node_cart_view
node_shopper -->|"registers or signs in"| node_auth
node_auth -->|"looks up users"| node_user_repo
node_shopper -->|"submits order"| node_checkout
node_checkout -->|"creates or cancels"| node_order_service
node_checkout -->|"lists and reads"| node_order_repo
node_checkout -->|"loads order items"| node_item_repo
node_order_service -->|"saves orders"| node_order_repo
node_order_service -->|"saves and reads items"| node_item_repo
node_order_service -->|"checks and updates stock"| node_product_repo
node_admin_actor -->|"manages store"| node_admin_controller
node_admin_controller -->|"updates status"| node_order_service
node_admin_controller -->|"lists orders"| node_order_repo
node_admin_controller -->|"loads order items"| node_item_repo
node_admin_controller -->|"manages products"| node_product_repo
node_order_repo -->|"persists"| node_order_model
node_item_repo -->|"persists"| node_item_model
node_product_repo -->|"persists"| node_product_model
node_user_repo -->|"persists"| node_user_model
node_payment_options -.->|"submits payment choice"| node_checkout
node_order_repo -.->|"stores data"| node_mysql
node_item_repo -.->|"stores data"| node_mysql
node_product_repo -.->|"stores data"| node_mysql
node_user_repo -.->|"stores data"| node_mysql

click node_catalog "https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/controller/HomeController.java"
click node_cart "https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/controller/CartController.java"
click node_cart_view "https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/resources/templates/cart.html"
click node_product_view "https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/resources/templates/product-detail.html"
click node_auth "https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/controller/AuthController.java"
click node_user_repo "https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/repository/UserRepository.java"
click node_user_model "https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/model/User.java"
click node_checkout "https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/controller/OrderController.java"
click node_order_service "https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/service/OrderService.java"
click node_order_repo "https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/repository/OrderRepository.java"
click node_item_repo "https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/repository/OrderItemRepository.java"
click node_order_model "https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/model/Order.java"
click node_item_model "https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/model/OrderItem.java"
click node_product_repo "https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/repository/ProductRepository.java"
click node_product_model "https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/model/Product.java"
click node_admin_controller "https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/controller/AdminController.java"
click node_mysql "https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/database/shop_online.sql"
click node_payment_options "https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/resources/templates/cart.html"

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,node_cart,node_cart_view,node_product_view toneBlue
class node_auth toneAmber
class node_checkout,node_order_service,node_payment_options toneMint
class node_admin_controller toneRose
class node_user_repo,node_user_model,node_order_repo,node_item_repo,node_order_model,node_item_model,node_product_repo,node_product_model,node_mysql,node_shopper,node_admin_actor toneIndigo
```

## Components

### Storefront

- [Catalog browsing](https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/controller/HomeController.java): `src/main/java/com/shop/controller/HomeController.java`
- [Session cart](https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/controller/CartController.java): `src/main/java/com/shop/controller/CartController.java`
- [Cart view](https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/resources/templates/cart.html): `src/main/resources/templates/cart.html`
- [Product pages](https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/resources/templates/product-detail.html): `src/main/resources/templates/product-detail.html`

### Accounts

- [Sign-in and registration](https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/controller/AuthController.java): `src/main/java/com/shop/controller/AuthController.java`

### Orders

- [Checkout and history](https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/controller/OrderController.java): `src/main/java/com/shop/controller/OrderController.java`
- [Order lifecycle](https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/service/OrderService.java): `src/main/java/com/shop/service/OrderService.java`
- [COD and bank transfer](https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/resources/templates/cart.html): `src/main/resources/templates/cart.html`

### Administration

- [Admin operations](https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/controller/AdminController.java): `src/main/java/com/shop/controller/AdminController.java`

### Persistence

- [User repository](https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/repository/UserRepository.java): `src/main/java/com/shop/repository/UserRepository.java`
- [User records](https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/model/User.java): `src/main/java/com/shop/model/User.java`
- [Order repository](https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/repository/OrderRepository.java): `src/main/java/com/shop/repository/OrderRepository.java`
- [Order-item repository](https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/repository/OrderItemRepository.java): `src/main/java/com/shop/repository/OrderItemRepository.java`
- [Order records](https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/model/Order.java): `src/main/java/com/shop/model/Order.java`
- [Order-item records](https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/model/OrderItem.java): `src/main/java/com/shop/model/OrderItem.java`
- [Product repository](https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/repository/ProductRepository.java): `src/main/java/com/shop/repository/ProductRepository.java`
- [Product and stock](https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/src/main/java/com/shop/model/Product.java): `src/main/java/com/shop/model/Product.java`
- [MySQL store](https://github.com/thieu2451220099/tranduythieu_24ct2_cnpm./blob/main/database/shop_online.sql): `database/shop_online.sql`

### Other components

- **Shopper**
- **Administrator**

## Connections

- Shopper → Catalog browsing: browses (evidence: `README.md`)
- Catalog browsing → Product repository: searches products (evidence: `src/main/java/com/shop/controller/HomeController.java`)
- Catalog browsing → Product pages: renders (evidence: `src/main/java/com/shop/controller/HomeController.java`)
- Shopper → Session cart: adds items (evidence: `src/main/java/com/shop/controller/CartController.java`)
- Session cart → Product repository: reads stock (evidence: `src/main/java/com/shop/controller/CartController.java`)
- Session cart → Cart view: renders (evidence: `src/main/java/com/shop/controller/CartController.java`)
- Shopper → Sign-in and registration: registers or signs in (evidence: `README.md`)
- Sign-in and registration → User repository: looks up users (evidence: `src/main/java/com/shop/controller/AuthController.java`)
- Shopper → Checkout and history: submits order (evidence: `src/main/java/com/shop/controller/OrderController.java`)
- Checkout and history → Order lifecycle: creates or cancels (evidence: `src/main/java/com/shop/controller/OrderController.java`)
- Checkout and history → Order repository: lists and reads (evidence: `src/main/java/com/shop/controller/OrderController.java`)
- Checkout and history → Order-item repository: loads order items (evidence: `src/main/java/com/shop/controller/OrderController.java`)
- Order lifecycle → Order repository: saves orders (evidence: `src/main/java/com/shop/service/OrderService.java`)
- Order lifecycle → Order-item repository: saves and reads items (evidence: `src/main/java/com/shop/service/OrderService.java`)
- Order lifecycle → Product repository: checks and updates stock (evidence: `src/main/java/com/shop/service/OrderService.java`)
- Administrator → Admin operations: manages store (evidence: `src/main/java/com/shop/controller/AdminController.java`)
- Admin operations → Order lifecycle: updates status (evidence: `src/main/java/com/shop/controller/AdminController.java`)
- Admin operations → Order repository: lists orders (evidence: `src/main/java/com/shop/controller/AdminController.java`)
- Admin operations → Order-item repository: loads order items (evidence: `src/main/java/com/shop/controller/AdminController.java`)
- Admin operations → Product repository: manages products (evidence: `src/main/java/com/shop/controller/AdminController.java`)
- Order repository → Order records: persists (evidence: `src/main/java/com/shop/repository/OrderRepository.java`)
- Order-item repository → Order-item records: persists (evidence: `src/main/java/com/shop/repository/OrderItemRepository.java`)
- Product repository → Product and stock: persists (evidence: `src/main/java/com/shop/repository/ProductRepository.java`)
- User repository → User records: persists (evidence: `src/main/java/com/shop/repository/UserRepository.java`)
- COD and bank transfer → Checkout and history: submits payment choice (evidence: `README.md`)
- Order repository → MySQL store: stores data (evidence: `README.md`)
- Order-item repository → MySQL store: stores data (evidence: `README.md`)
- Product repository → MySQL store: stores data (evidence: `README.md`)
- User repository → MySQL store: stores data (evidence: `README.md`)
