# ngocphu1809/24ct2-holengocphu architecture

> Architecture diagram of the GitHub repository ngocphu1809/24ct2-holengocphu, 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/ngocphu1809/24ct2-holengocphu
- Repository: https://github.com/ngocphu1809/24ct2-holengocphu

## Overview

SHOPBOOKS is a Vietnamese book shop with customer storefront, account access, checkout and order tracking, plus separate admin and employee workspaces. The main customer flow is storefront browsing in App, selecting a book, managing the cart, and submitting an order; customer order history is another API-backed view. Admin and employee screens provide catalog, inventory, revenue, and order-management capabilities. The excerpts show frontend component calls and API routes, but not the server implementation or its database wiring, so those backend relationships remain unverified.

Main entry points: [`src/App.jsx`](https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/App.jsx) (Storefront), [`src/api.js`](https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/api.js) (API client), [`src/pages/Admin.jsx`](https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/pages/Admin.jsx) (Admin workspace), [`src/main.jsx`](https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/main.jsx) (React entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_app["Storefront<br/>[App.jsx]"]
  node_bookdata["Sample books<br/>[books.js]"]
  node_bookdetail["Book details<br/>[ChiTietSach.jsx]"]
end

subgraph group_customer["Customer flows"]
  node_cart["Shopping cart<br/>[GioHang.jsx]"]
  node_checkout["Checkout<br/>[DatHang.jsx]"]
  node_orders["Order history<br/>[DonHang.jsx]"]
  node_orderdetail["Order details<br/>[ChiTietDonHang.jsx]"]
  node_register["Registration<br/>[DangKy.jsx]"]
  node_login["Sign in<br/>[DangNhap.jsx]"]
end

subgraph group_operations["Store operations"]
  node_admin["Admin workspace<br/>[Admin.jsx]"]
  node_employee["Employee workspace<br/>[NhanVien.jsx]"]
end

subgraph group_platform["App platform"]
  node_api["API client<br/>[api.js]"]
  node_server["HTTP server<br/>[index.js]"]
  node_database[("Shop database<br/>[schema.sql]")]
  node_bootstrap["React entry<br/>[main.jsx]"]
  node_notifications["Notifications"]
end

node_shopper(("Shopper"))

node_shopper -->|"browses"| node_app
node_app -->|"loads defaults"| node_bookdata
node_app -->|"renders"| node_bookdetail
node_app -->|"renders"| node_cart
node_app -->|"renders"| node_checkout
node_app -->|"renders"| node_orders
node_app -->|"renders"| node_register
node_app -->|"renders"| node_login
node_app -->|"renders"| node_admin
node_app -->|"renders"| node_employee
node_app -->|"loads books"| node_api
node_admin -->|"manages catalog"| node_api
node_admin -->|"uses defaults"| node_bookdata
node_employee -->|"requests data"| node_api
node_checkout -->|"creates order"| node_api
node_orders -->|"loads orders"| node_api
node_register -->|"registers account"| node_api
node_login -->|"authenticates"| node_api
node_bootstrap -->|"renders"| node_app
node_bootstrap -->|"renders"| node_notifications
node_api -.->|"sends HTTP requests"| node_server

click node_app "https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/App.jsx"
click node_bookdata "https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/data/books.js"
click node_bookdetail "https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/pages/ChiTietSach.jsx"
click node_cart "https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/pages/GioHang.jsx"
click node_checkout "https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/pages/DatHang.jsx"
click node_orders "https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/pages/DonHang.jsx"
click node_orderdetail "https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/pages/ChiTietDonHang.jsx"
click node_register "https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/pages/DangKy.jsx"
click node_login "https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/pages/DangNhap.jsx"
click node_admin "https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/pages/Admin.jsx"
click node_employee "https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/pages/NhanVien.jsx"
click node_api "https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/api.js"
click node_server "https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/server/index.js"
click node_database "https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/database/schema.sql"
click node_bootstrap "https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/main.jsx"
click node_notifications "https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/components/NotificationCenter.jsx"

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_app,node_bookdata,node_bookdetail toneBlue
class node_cart,node_checkout,node_orders,node_orderdetail,node_register,node_login toneAmber
class node_admin,node_employee toneMint
class node_api,node_server,node_database,node_bootstrap,node_notifications toneRose
class node_shopper toneIndigo
```

## Components

### Storefront

- [Storefront](https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/App.jsx): `src/App.jsx`
- [Sample books](https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/data/books.js): `src/data/books.js`
- [Book details](https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/pages/ChiTietSach.jsx): `src/pages/ChiTietSach.jsx`

### Customer flows

- [Shopping cart](https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/pages/GioHang.jsx): `src/pages/GioHang.jsx`
- [Checkout](https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/pages/DatHang.jsx): `src/pages/DatHang.jsx`
- [Order history](https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/pages/DonHang.jsx): `src/pages/DonHang.jsx`
- [Order details](https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/pages/ChiTietDonHang.jsx): `src/pages/ChiTietDonHang.jsx`
- [Registration](https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/pages/DangKy.jsx): `src/pages/DangKy.jsx`
- [Sign in](https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/pages/DangNhap.jsx): `src/pages/DangNhap.jsx`

### Store operations

- [Admin workspace](https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/pages/Admin.jsx): `src/pages/Admin.jsx`
- [Employee workspace](https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/pages/NhanVien.jsx): `src/pages/NhanVien.jsx`

### App platform

- [API client](https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/api.js): `src/api.js`
- [HTTP server](https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/server/index.js): `server/index.js`
- [Shop database](https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/database/schema.sql): `database/schema.sql`
- [React entry](https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/main.jsx): `src/main.jsx`
- [Notifications](https://github.com/ngocphu1809/24ct2-holengocphu/blob/main/src/components/NotificationCenter.jsx): `src/components/NotificationCenter.jsx`

### Other components

- **Shopper**

## Connections

- Shopper → Storefront: browses (evidence: `src/App.jsx`)
- Storefront → Sample books: loads defaults (evidence: `src/App.jsx`)
- Storefront → Book details: renders (evidence: `src/App.jsx`)
- Storefront → Shopping cart: renders (evidence: `src/App.jsx`)
- Storefront → Checkout: renders (evidence: `src/App.jsx`)
- Storefront → Order history: renders (evidence: `src/App.jsx`)
- Storefront → Registration: renders (evidence: `src/App.jsx`)
- Storefront → Sign in: renders (evidence: `src/App.jsx`)
- Storefront → Admin workspace: renders (evidence: `src/App.jsx`)
- Storefront → Employee workspace: renders (evidence: `src/App.jsx`)
- Storefront → API client: loads books (evidence: `src/App.jsx`)
- Admin workspace → API client: manages catalog (evidence: `src/pages/Admin.jsx`)
- Admin workspace → Sample books: uses defaults (evidence: `src/pages/Admin.jsx`)
- Employee workspace → API client: requests data (evidence: `src/pages/NhanVien.jsx`)
- Checkout → API client: creates order (evidence: `src/pages/DatHang.jsx`)
- Order history → API client: loads orders (evidence: `src/pages/DonHang.jsx`)
- Registration → API client: registers account (evidence: `src/pages/DangKy.jsx`)
- Sign in → API client: authenticates (evidence: `src/pages/DangNhap.jsx`)
- React entry → Storefront: renders (evidence: `src/main.jsx`)
- React entry → Notifications: renders (evidence: `src/main.jsx`)
- API client → HTTP server: sends HTTP requests
