# ttbhanh/eshop-sut architecture

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

- Interactive diagram: https://gitdiagram.com/ttbhanh/eshop-sut
- Repository: https://github.com/ttbhanh/eshop-sut

## Overview

EShop is a multi-client commerce application: shoppers browse and search products, manage a cart, apply coupons, and submit orders; account flows cover registration, login, recovery, profiles, and order history. The web storefront and mobile app call the Express API, which uses SQLite for persistent records. A separate admin client supports catalog, coupon, user, and order operations. The README documents additional order-state and dashboard capabilities, but their implementation details are not fully sampled; those branches are represented at subsystem level. Edges reflect shown imports, calls, and documented capabilities.

Main entry points: [`frontend-web/src/App.jsx`](https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/App.jsx) (Web app routing), [`backend/server.js`](https://github.com/ttbhanh/eshop-sut/blob/main/backend/server.js) (Commerce API), [`frontend-web/src/pages/Checkout.jsx`](https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/pages/Checkout.jsx) (Checkout), [`frontend-web/src/context/CartContext.jsx`](https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/context/CartContext.jsx) (Cart state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Web storefront"]
  node_webapp["Web app routing<br/>[App.jsx]"]
  node_auth["Authentication state<br/>[AuthContext.jsx]"]
  node_cartstate["Cart state<br/>[CartContext.jsx]"]
  node_catalog["Product catalog<br/>[Home.jsx]"]
  node_product["Product detail<br/>[ProductDetail.jsx]"]
  node_cartpage["Cart page<br/>[Cart.jsx]"]
  node_checkout["Checkout<br/>[Checkout.jsx]"]
  node_login["Login<br/>[Login.jsx]"]
  node_register["Registration<br/>[Register.jsx]"]
  node_profile["Profile and orders<br/>[Profile.jsx]"]
  node_recovery["Password recovery<br/>[ForgotPassword.jsx]"]
end

subgraph group_commerce["Commerce API"]
  node_api["Commerce API<br/>[server.js]"]
  node_database[("SQLite data store<br/>[database.js]")]
  node_orderflow["Order management"]
  node_couponflow["Coupon management<br/>[server.js]"]
end

subgraph group_admin["Admin console"]
  node_adminapp["Admin console<br/>[App.jsx]"]
  node_adminfeatures["Admin operations"]
end

subgraph group_mobile["Mobile app"]
  node_mobileapp["Mobile storefront<br/>[App.js]"]
end

node_shopper(("Shopper"))

node_shopper -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_catalog
node_webapp -->|"routes to"| node_product
node_webapp -->|"routes to"| node_cartpage
node_webapp -->|"routes to"| node_checkout
node_webapp -->|"routes to"| node_login
node_webapp -->|"routes to"| node_register
node_webapp -->|"routes to"| node_profile
node_webapp -->|"routes to"| node_recovery
node_webapp -->|"provides state"| node_auth
node_webapp -->|"provides state"| node_cartstate
node_catalog -->|"fetches products"| node_api
node_catalog -->|"adds products"| node_cartstate
node_product -->|"adds products"| node_cartstate
node_cartpage -->|"uses cart"| node_cartstate
node_checkout -->|"reads and clears"| node_cartstate
node_checkout -->|"reads identity"| node_auth
node_checkout -->|"submits checkout"| node_api
node_checkout -->|"applies coupon"| node_couponflow
node_checkout -->|"records coupon use"| node_api
node_login -->|"calls login"| node_auth
node_register -.->|"registers account"| node_api
node_recovery -.->|"requests recovery"| node_api
node_profile -->|"reads identity"| node_auth
node_profile -->|"updates profile"| node_api
node_profile -->|"loads and cancels"| node_orderflow
node_api -->|"queries and updates"| node_database
node_api -.->|"handles order requests"| node_orderflow
node_api -->|"handles coupon requests"| node_couponflow
node_shopper -->|"uses"| node_mobileapp
node_mobileapp -->|"fetches products and orders"| node_api
node_adminapp -->|"calls admin endpoints"| node_api
node_adminapp -->|"manages catalog and coupons"| node_adminfeatures
node_adminfeatures -.->|"supports order operations"| node_orderflow
node_adminfeatures -.->|"uses commerce records"| node_database

click node_webapp "https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/App.jsx"
click node_auth "https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/context/AuthContext.jsx"
click node_cartstate "https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/context/CartContext.jsx"
click node_catalog "https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/pages/Home.jsx"
click node_product "https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/pages/ProductDetail.jsx"
click node_cartpage "https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/pages/Cart.jsx"
click node_checkout "https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/pages/Checkout.jsx"
click node_login "https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/pages/Login.jsx"
click node_register "https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/pages/Register.jsx"
click node_profile "https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/pages/Profile.jsx"
click node_recovery "https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/pages/ForgotPassword.jsx"
click node_api "https://github.com/ttbhanh/eshop-sut/blob/main/backend/server.js"
click node_database "https://github.com/ttbhanh/eshop-sut/blob/main/backend/database.js"
click node_orderflow "https://github.com/ttbhanh/eshop-sut/tree/main/backend"
click node_couponflow "https://github.com/ttbhanh/eshop-sut/blob/main/backend/server.js"
click node_adminapp "https://github.com/ttbhanh/eshop-sut/blob/main/frontend-admin/src/App.jsx"
click node_adminfeatures "https://github.com/ttbhanh/eshop-sut/tree/main/backend"
click node_mobileapp "https://github.com/ttbhanh/eshop-sut/blob/main/frontend-mobile/App.js"

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_webapp,node_auth,node_cartstate,node_catalog,node_product,node_cartpage,node_checkout,node_login,node_register,node_profile,node_recovery toneBlue
class node_api,node_database,node_orderflow,node_couponflow toneAmber
class node_adminapp,node_adminfeatures toneMint
class node_mobileapp toneRose
class node_shopper toneIndigo
```

## Components

### Web storefront

- [Web app routing](https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/App.jsx): `frontend-web/src/App.jsx`
- [Authentication state](https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/context/AuthContext.jsx): `frontend-web/src/context/AuthContext.jsx`
- [Cart state](https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/context/CartContext.jsx): `frontend-web/src/context/CartContext.jsx`
- [Product catalog](https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/pages/Home.jsx): `frontend-web/src/pages/Home.jsx`
- [Product detail](https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/pages/ProductDetail.jsx): `frontend-web/src/pages/ProductDetail.jsx`
- [Cart page](https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/pages/Cart.jsx): `frontend-web/src/pages/Cart.jsx`
- [Checkout](https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/pages/Checkout.jsx): `frontend-web/src/pages/Checkout.jsx`
- [Login](https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/pages/Login.jsx): `frontend-web/src/pages/Login.jsx`
- [Registration](https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/pages/Register.jsx): `frontend-web/src/pages/Register.jsx`
- [Profile and orders](https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/pages/Profile.jsx): `frontend-web/src/pages/Profile.jsx`
- [Password recovery](https://github.com/ttbhanh/eshop-sut/blob/main/frontend-web/src/pages/ForgotPassword.jsx): `frontend-web/src/pages/ForgotPassword.jsx`

### Commerce API

- [Commerce API](https://github.com/ttbhanh/eshop-sut/blob/main/backend/server.js): `backend/server.js`
- [SQLite data store](https://github.com/ttbhanh/eshop-sut/blob/main/backend/database.js): `backend/database.js`
- [Order management](https://github.com/ttbhanh/eshop-sut/tree/main/backend): `backend`
- [Coupon management](https://github.com/ttbhanh/eshop-sut/blob/main/backend/server.js): `backend/server.js`

### Admin console

- [Admin console](https://github.com/ttbhanh/eshop-sut/blob/main/frontend-admin/src/App.jsx): `frontend-admin/src/App.jsx`
- [Admin operations](https://github.com/ttbhanh/eshop-sut/tree/main/backend): `backend`

### Mobile app

- [Mobile storefront](https://github.com/ttbhanh/eshop-sut/blob/main/frontend-mobile/App.js): `frontend-mobile/App.js`

### Other components

- **Shopper**

## Connections

- Shopper → Web app routing: uses (evidence: `frontend-web/src/App.jsx`)
- Web app routing → Product catalog: routes to (evidence: `frontend-web/src/App.jsx`)
- Web app routing → Product detail: routes to (evidence: `frontend-web/src/App.jsx`)
- Web app routing → Cart page: routes to (evidence: `frontend-web/src/App.jsx`)
- Web app routing → Checkout: routes to (evidence: `frontend-web/src/App.jsx`)
- Web app routing → Login: routes to (evidence: `frontend-web/src/App.jsx`)
- Web app routing → Registration: routes to (evidence: `frontend-web/src/App.jsx`)
- Web app routing → Profile and orders: routes to (evidence: `frontend-web/src/App.jsx`)
- Web app routing → Password recovery: routes to (evidence: `frontend-web/src/App.jsx`)
- Web app routing → Authentication state: provides state (evidence: `frontend-web/src/App.jsx`)
- Web app routing → Cart state: provides state (evidence: `frontend-web/src/App.jsx`)
- Product catalog → Commerce API: fetches products (evidence: `frontend-web/src/pages/Home.jsx`)
- Product catalog → Cart state: adds products (evidence: `frontend-web/src/pages/Home.jsx`)
- Product detail → Cart state: adds products (evidence: `frontend-web/src/pages/ProductDetail.jsx`)
- Cart page → Cart state: uses cart (evidence: `frontend-web/src/pages/Cart.jsx`)
- Checkout → Cart state: reads and clears (evidence: `frontend-web/src/pages/Checkout.jsx`)
- Checkout → Authentication state: reads identity (evidence: `frontend-web/src/pages/Checkout.jsx`)
- Checkout → Commerce API: submits checkout (evidence: `frontend-web/src/pages/Checkout.jsx`)
- Checkout → Coupon management: applies coupon (evidence: `frontend-web/src/pages/Checkout.jsx`)
- Checkout → Commerce API: records coupon use (evidence: `frontend-web/src/pages/Checkout.jsx`)
- Login → Authentication state: calls login (evidence: `frontend-web/src/pages/Login.jsx`)
- Registration → Commerce API: registers account
- Password recovery → Commerce API: requests recovery
- Profile and orders → Authentication state: reads identity (evidence: `frontend-web/src/pages/Profile.jsx`)
- Profile and orders → Commerce API: updates profile (evidence: `frontend-web/src/pages/Profile.jsx`)
- Profile and orders → Order management: loads and cancels (evidence: `frontend-web/src/pages/Profile.jsx`)
- Commerce API → SQLite data store: queries and updates (evidence: `backend/server.js`)
- Commerce API → Order management: handles order requests (evidence: `backend/server.js`)
- Commerce API → Coupon management: handles coupon requests (evidence: `backend/server.js`)
- Shopper → Mobile storefront: uses (evidence: `frontend-mobile/App.js`)
- Mobile storefront → Commerce API: fetches products and orders (evidence: `frontend-mobile/App.js`)
- Admin console → Commerce API: calls admin endpoints (evidence: `frontend-admin/src/App.jsx`)
- Admin console → Admin operations: manages catalog and coupons (evidence: `frontend-admin/src/App.jsx`)
- Admin operations → Order management: supports order operations
- Admin operations → SQLite data store: uses commerce records (evidence: `backend/server.js`)
