# hoang310/webxedap architecture

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

- Interactive diagram: https://gitdiagram.com/hoang310/webxedap
- Repository: https://github.com/hoang310/webxedap

## Overview

webXeDap is a bicycle-commerce application with a React storefront and administration interface backed by an Express/Mongoose API. The customer-facing journey covers browsing and searching products, viewing details, managing a cart, checkout, and account access; reviews are a separate product capability. Administration covers catalog, categories, orders, users, statistics, and AI description generation. The sampled files establish backend routing and several service-to-model calls, but do not show the full checkout implementation or how frontend API calls map to backend endpoints; those links are therefore omitted or marked unverified.

Main entry points: [`backend/app.js`](https://github.com/hoang310/webxedap/blob/main/backend/app.js) (Express app), [`fontend/src/App.js`](https://github.com/hoang310/webxedap/blob/main/fontend/src/App.js) (React router), [`fontend/src/pages`](https://github.com/hoang310/webxedap/tree/main/fontend/src/pages) (Storefront pages), [`backend/routes/aiRoutes.js`](https://github.com/hoang310/webxedap/blob/main/backend/routes/aiRoutes.js) (AI routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web interface"]
  node_app["React router<br/>[App.js]"]
  node_storefront["Storefront pages"]
  node_cart["Cart state<br/>[CartContext.js]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_catalog["Catalog and feedback"]
  node_product_ctrl["Product API"]
  node_product_service["Product service<br/>[productService.js]"]
  node_product_model[("Product records<br/>[Product.js]")]
  node_category_ctrl["Category API"]
  node_category_service["Category service<br/>[categoryService.js]"]
  node_category_model[("Category records<br/>[Category.js]")]
  node_review_ctrl["Review API"]
  node_review_service["Review service<br/>[reviewService.js]"]
  node_review_model[("Review records<br/>[Review.js]")]
end

subgraph group_commerce["Accounts and orders"]
  node_order_ctrl["Order API<br/>[orderController.js]"]
  node_order_service["Order service<br/>[orderService.js]"]
  node_order_model[("Order records<br/>[Order.js]")]
  node_user_ctrl["User API<br/>[userController.js]"]
  node_user_service["User service<br/>[userService.js]"]
  node_user_model[("User records<br/>[User.js]")]
end

subgraph group_platform["API and persistence"]
  node_server["Express app<br/>[app.js]"]
  node_database[("MongoDB connection<br/>[db.js]")]
end

subgraph group_admin["Administration"]
  node_admin_ui["Admin screens"]
  node_ai_ui["AI description UI<br/>[Ai.jsx]"]
  node_ai_routes["AI routes<br/>[aiRoutes.js]"]
  node_ai_ctrl["AI description API<br/>[aiController.js]"]
end

node_shopper(("Shopper"))

node_shopper -->|"uses"| node_app
node_app -->|"routes to"| node_storefront
node_app -->|"routes to"| node_admin_ui
node_storefront -.->|"uses"| node_cart
node_storefront -.->|"requests data"| node_api_client
node_admin_ui -.->|"requests data"| node_api_client
node_server -->|"connects"| node_database
node_server -->|"mounts routes"| node_product_ctrl
node_server -->|"mounts routes"| node_category_ctrl
node_server -->|"mounts routes"| node_review_ctrl
node_server -->|"mounts routes"| node_order_ctrl
node_server -->|"mounts routes"| node_user_ctrl
node_server -->|"mounts routes"| node_ai_routes
node_product_ctrl -->|"delegates to"| node_product_service
node_product_service -->|"queries"| node_product_model
node_category_ctrl -->|"delegates to"| node_category_service
node_category_service -->|"queries"| node_category_model
node_review_ctrl -->|"delegates to"| node_review_service
node_review_service -->|"queries"| node_review_model
node_order_ctrl -->|"delegates to"| node_order_service
node_order_service -->|"queries"| node_order_model
node_user_ctrl -->|"delegates to"| node_user_service
node_user_service -->|"queries"| node_user_model
node_ai_routes -->|"dispatches to"| node_ai_ctrl
node_ai_ui -.->|"requests generation"| node_ai_routes

click node_app "https://github.com/hoang310/webxedap/blob/main/fontend/src/App.js"
click node_storefront "https://github.com/hoang310/webxedap/tree/main/fontend/src/pages"
click node_cart "https://github.com/hoang310/webxedap/blob/main/fontend/src/context/CartContext.js"
click node_api_client "https://github.com/hoang310/webxedap/blob/main/fontend/src/services/api.js"
click node_product_ctrl "https://github.com/hoang310/webxedap/blob/main/backend/controllers/productController.js"
click node_product_service "https://github.com/hoang310/webxedap/blob/main/backend/services/productService.js"
click node_product_model "https://github.com/hoang310/webxedap/blob/main/backend/models/Product.js"
click node_category_ctrl "https://github.com/hoang310/webxedap/blob/main/backend/controllers/categoryController.js"
click node_category_service "https://github.com/hoang310/webxedap/blob/main/backend/services/categoryService.js"
click node_category_model "https://github.com/hoang310/webxedap/blob/main/backend/models/Category.js"
click node_review_ctrl "https://github.com/hoang310/webxedap/blob/main/backend/controllers/reviewController.js"
click node_review_service "https://github.com/hoang310/webxedap/blob/main/backend/services/reviewService.js"
click node_review_model "https://github.com/hoang310/webxedap/blob/main/backend/models/Review.js"
click node_order_ctrl "https://github.com/hoang310/webxedap/blob/main/backend/controllers/orderController.js"
click node_order_service "https://github.com/hoang310/webxedap/blob/main/backend/services/orderService.js"
click node_order_model "https://github.com/hoang310/webxedap/blob/main/backend/models/Order.js"
click node_user_ctrl "https://github.com/hoang310/webxedap/blob/main/backend/controllers/userController.js"
click node_user_service "https://github.com/hoang310/webxedap/blob/main/backend/services/userService.js"
click node_user_model "https://github.com/hoang310/webxedap/blob/main/backend/models/User.js"
click node_server "https://github.com/hoang310/webxedap/blob/main/backend/app.js"
click node_database "https://github.com/hoang310/webxedap/blob/main/backend/db.js"
click node_admin_ui "https://github.com/hoang310/webxedap/tree/main/fontend/src/pages/admin"
click node_ai_ui "https://github.com/hoang310/webxedap/blob/main/fontend/src/pages/admin/ai/Ai.jsx"
click node_ai_routes "https://github.com/hoang310/webxedap/blob/main/backend/routes/aiRoutes.js"
click node_ai_ctrl "https://github.com/hoang310/webxedap/blob/main/backend/controllers/aiController.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_app,node_storefront,node_cart,node_api_client toneBlue
class node_product_ctrl,node_product_service,node_product_model,node_category_ctrl,node_category_service,node_category_model,node_review_ctrl,node_review_service,node_review_model toneAmber
class node_order_ctrl,node_order_service,node_order_model,node_user_ctrl,node_user_service,node_user_model toneMint
class node_server,node_database toneRose
class node_admin_ui,node_ai_ui,node_ai_routes,node_ai_ctrl,node_shopper toneIndigo
```

## Components

### Web interface

- [React router](https://github.com/hoang310/webxedap/blob/main/fontend/src/App.js): `fontend/src/App.js`
- [Storefront pages](https://github.com/hoang310/webxedap/tree/main/fontend/src/pages): `fontend/src/pages`
- [Cart state](https://github.com/hoang310/webxedap/blob/main/fontend/src/context/CartContext.js): `fontend/src/context/CartContext.js`
- [API client](https://github.com/hoang310/webxedap/blob/main/fontend/src/services/api.js): `fontend/src/services/api.js`

### Catalog and feedback

- [Product API](https://github.com/hoang310/webxedap/blob/main/backend/controllers/productController.js): `backend/controllers/productController.js`
- [Product service](https://github.com/hoang310/webxedap/blob/main/backend/services/productService.js): `backend/services/productService.js`
- [Product records](https://github.com/hoang310/webxedap/blob/main/backend/models/Product.js): `backend/models/Product.js`
- [Category API](https://github.com/hoang310/webxedap/blob/main/backend/controllers/categoryController.js): `backend/controllers/categoryController.js`
- [Category service](https://github.com/hoang310/webxedap/blob/main/backend/services/categoryService.js): `backend/services/categoryService.js`
- [Category records](https://github.com/hoang310/webxedap/blob/main/backend/models/Category.js): `backend/models/Category.js`
- [Review API](https://github.com/hoang310/webxedap/blob/main/backend/controllers/reviewController.js): `backend/controllers/reviewController.js`
- [Review service](https://github.com/hoang310/webxedap/blob/main/backend/services/reviewService.js): `backend/services/reviewService.js`
- [Review records](https://github.com/hoang310/webxedap/blob/main/backend/models/Review.js): `backend/models/Review.js`

### Accounts and orders

- [Order API](https://github.com/hoang310/webxedap/blob/main/backend/controllers/orderController.js): `backend/controllers/orderController.js`
- [Order service](https://github.com/hoang310/webxedap/blob/main/backend/services/orderService.js): `backend/services/orderService.js`
- [Order records](https://github.com/hoang310/webxedap/blob/main/backend/models/Order.js): `backend/models/Order.js`
- [User API](https://github.com/hoang310/webxedap/blob/main/backend/controllers/userController.js): `backend/controllers/userController.js`
- [User service](https://github.com/hoang310/webxedap/blob/main/backend/services/userService.js): `backend/services/userService.js`
- [User records](https://github.com/hoang310/webxedap/blob/main/backend/models/User.js): `backend/models/User.js`

### API and persistence

- [Express app](https://github.com/hoang310/webxedap/blob/main/backend/app.js): `backend/app.js`
- [MongoDB connection](https://github.com/hoang310/webxedap/blob/main/backend/db.js): `backend/db.js`

### Administration

- [Admin screens](https://github.com/hoang310/webxedap/tree/main/fontend/src/pages/admin): `fontend/src/pages/admin`
- [AI description UI](https://github.com/hoang310/webxedap/blob/main/fontend/src/pages/admin/ai/Ai.jsx): `fontend/src/pages/admin/ai/Ai.jsx`
- [AI routes](https://github.com/hoang310/webxedap/blob/main/backend/routes/aiRoutes.js): `backend/routes/aiRoutes.js`
- [AI description API](https://github.com/hoang310/webxedap/blob/main/backend/controllers/aiController.js): `backend/controllers/aiController.js`

### Other components

- **Shopper**

## Connections

- Shopper → React router: uses
- React router → Storefront pages: routes to (evidence: `fontend/src/App.js`)
- React router → Admin screens: routes to (evidence: `fontend/src/App.js`)
- Storefront pages → Cart state: uses
- Storefront pages → API client: requests data (evidence: `fontend/src/pages/Search.jsx`)
- Admin screens → API client: requests data (evidence: `fontend/src/pages/admin/product/Product.jsx`)
- Express app → MongoDB connection: connects (evidence: `backend/app.js`)
- Express app → Product API: mounts routes (evidence: `backend/app.js`)
- Express app → Category API: mounts routes (evidence: `backend/app.js`)
- Express app → Review API: mounts routes (evidence: `backend/app.js`)
- Express app → Order API: mounts routes (evidence: `backend/app.js`)
- Express app → User API: mounts routes (evidence: `backend/app.js`)
- Express app → AI routes: mounts routes (evidence: `backend/app.js`)
- Product API → Product service: delegates to (evidence: `backend/controllers/productController.js`)
- Product service → Product records: queries (evidence: `backend/services/productService.js`)
- Category API → Category service: delegates to (evidence: `backend/controllers/categoryController.js`)
- Category service → Category records: queries (evidence: `backend/services/categoryService.js`)
- Review API → Review service: delegates to (evidence: `backend/controllers/reviewController.js`)
- Review service → Review records: queries (evidence: `backend/services/reviewService.js`)
- Order API → Order service: delegates to (evidence: `backend/controllers/orderController.js`)
- Order service → Order records: queries (evidence: `backend/services/orderService.js`)
- User API → User service: delegates to (evidence: `backend/controllers/userController.js`)
- User service → User records: queries (evidence: `backend/services/userService.js`)
- AI routes → AI description API: dispatches to (evidence: `backend/routes/aiRoutes.js`)
- AI description UI → AI routes: requests generation
