# asuna-chan123/congnghephanmem architecture

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

- Interactive diagram: https://gitdiagram.com/asuna-chan123/congnghephanmem
- Repository: https://github.com/asuna-chan123/congnghephanmem

## Overview

This repository implements an equipment-rental storefront and management backend. Customers browse equipment, manage a cart, and check out; the backend creates rental orders and supports accounts, wallet transactions, favorites, and product reviews/Q&A. Staff have administrative device, category, customer, and order-management capabilities. The graph follows the Express entry point into API routes and the evidenced controller, service, model, and database calls. The README gives no additional product description; several feature modules are indexed but their implementations were not sampled, so their internal flows are omitted.

Main entry points: [`index.js`](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/index.js) (Express server), [`src/controllers/cart.controller.js`](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/controllers/cart.controller.js) (Cart and checkout), [`src/models/db.js`](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/models/db.js) (PostgreSQL access), [`src/models/order.model.js`](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/models/order.model.js) (Order model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront APIs"]
  node_web["Web client<br/>[app.js]"]
  node_server["Express server<br/>[index.js]"]
  node_home["Home API<br/>[home.route.js]"]
  node_products["Product API<br/>[product.route.js]"]
  node_product_handler["Product controller"]
  node_favorites["Favorites API<br/>[favorite.route.js]"]
  node_favorite_handler["Favorites controller"]
  node_reviews["Reviews API<br/>[review.route.js]"]
  node_review_handler["Review controller"]
  node_review_model["Review model<br/>[review.model.js]"]
end

subgraph group_identity["Accounts and Wallet"]
  node_auth["Authentication<br/>[routes.js]"]
  node_auth_handler["Auth controller<br/>[controller.js]"]
  node_auth_service["Auth service<br/>[service.js]"]
  node_customer_api["Customer profile<br/>[routes.js]"]
  node_customer_handler["Customer controller<br/>[controller.js]"]
  node_payment_api["Wallet API<br/>[routes.js]"]
  node_payment_handler["Wallet controller<br/>[controller.js]"]
  node_payment_service["Wallet service<br/>[service.js]"]
end

subgraph group_commerce["Rental Commerce"]
  node_cart_api["Cart API<br/>[cart.route.js]"]
  node_cart_handler["Cart and checkout<br/>[cart.controller.js]"]
  node_cart_model["Cart model<br/>[cart.model.js]"]
  node_orders_api["Orders API<br/>[order.route.js]"]
  node_order_handler["Order controller"]
  node_order_model["Order model<br/>[order.model.js]"]
end

subgraph group_operations["Catalog Administration"]
  node_admin_api["Admin API<br/>[admin.route.js]"]
  node_admin_handler["Admin controller"]
end

subgraph group_persistence["Data and Observability"]
  node_db[("PostgreSQL access<br/>[db.js]")]
  node_logger["Logger<br/>[logger.js]"]
  node_metrics["Metrics middleware"]
end

node_shopper(("Customer"))
node_staff(("Staff"))

node_shopper -.->|"uses"| node_web
node_web -.->|"requests"| node_server
node_server -->|"mounts"| node_home
node_server -->|"mounts"| node_products
node_products -->|"routes to"| node_product_handler
node_server -->|"mounts"| node_favorites
node_favorites -->|"routes to"| node_favorite_handler
node_server -->|"mounts"| node_reviews
node_reviews -->|"routes to"| node_review_handler
node_review_handler -->|"calls"| node_review_model
node_server -->|"mounts"| node_auth
node_auth -->|"routes to"| node_auth_handler
node_auth_handler -->|"calls"| node_auth_service
node_server -->|"mounts"| node_customer_api
node_customer_api -->|"routes to"| node_customer_handler
node_server -->|"mounts"| node_payment_api
node_payment_api -->|"routes to"| node_payment_handler
node_payment_handler -->|"calls"| node_payment_service
node_server -->|"mounts"| node_cart_api
node_cart_api -->|"routes to"| node_cart_handler
node_cart_handler -->|"calls"| node_cart_model
node_cart_handler -->|"creates order"| node_order_model
node_cart_handler -->|"withdraws funds"| node_payment_service
node_server -->|"mounts"| node_orders_api
node_orders_api -->|"routes to"| node_order_handler
node_order_handler -->|"calls"| node_order_model
node_server -->|"mounts"| node_admin_api
node_admin_api -->|"routes to"| node_admin_handler
node_admin_handler -->|"queries"| node_db
node_cart_model -->|"queries"| node_db
node_order_model -->|"queries"| node_db
node_review_model -->|"queries"| node_db
node_server -->|"registers"| node_metrics
node_server -->|"uses"| node_logger
node_metrics -->|"logs through"| node_logger
node_staff -.->|"manages"| node_admin_api

click node_web "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/public/js/app.js"
click node_server "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/index.js"
click node_home "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/routes/home.route.js"
click node_products "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/routes/product.route.js"
click node_product_handler "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/controllers/product.controller.js"
click node_favorites "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/routes/favorite.route.js"
click node_favorite_handler "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/controllers/favorite.controller.js"
click node_reviews "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/routes/review.route.js"
click node_review_handler "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/controllers/review.controller.js"
click node_review_model "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/models/review.model.js"
click node_auth "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/Auth/routes.js"
click node_auth_handler "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/Auth/controller.js"
click node_auth_service "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/Auth/service.js"
click node_customer_api "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/Customer/routes.js"
click node_customer_handler "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/Customer/controller.js"
click node_payment_api "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/Payment/routes.js"
click node_payment_handler "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/Payment/controller.js"
click node_payment_service "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/Payment/service.js"
click node_cart_api "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/routes/cart.route.js"
click node_cart_handler "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/controllers/cart.controller.js"
click node_cart_model "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/models/cart.model.js"
click node_orders_api "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/routes/order.route.js"
click node_order_handler "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/controllers/order.controller.js"
click node_order_model "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/models/order.model.js"
click node_admin_api "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/routes/admin.route.js"
click node_admin_handler "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/controllers/admin.controller.js"
click node_db "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/models/db.js"
click node_logger "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/utils/logger.js"
click node_metrics "https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/middleware/metrics.middleware.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_web,node_server,node_home,node_products,node_product_handler,node_favorites,node_favorite_handler,node_reviews,node_review_handler,node_review_model toneBlue
class node_auth,node_auth_handler,node_auth_service,node_customer_api,node_customer_handler,node_payment_api,node_payment_handler,node_payment_service toneAmber
class node_cart_api,node_cart_handler,node_cart_model,node_orders_api,node_order_handler,node_order_model toneMint
class node_admin_api,node_admin_handler toneRose
class node_db,node_logger,node_metrics,node_shopper,node_staff toneIndigo
```

## Components

### Storefront APIs

- [Web client](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/public/js/app.js): `public/js/app.js`
- [Express server](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/index.js): `index.js`
- [Home API](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/routes/home.route.js): `src/routes/home.route.js`
- [Product API](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/routes/product.route.js): `src/routes/product.route.js`
- [Product controller](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/controllers/product.controller.js): `src/controllers/product.controller.js`
- [Favorites API](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/routes/favorite.route.js): `src/routes/favorite.route.js`
- [Favorites controller](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/controllers/favorite.controller.js): `src/controllers/favorite.controller.js`
- [Reviews API](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/routes/review.route.js): `src/routes/review.route.js`
- [Review controller](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/controllers/review.controller.js): `src/controllers/review.controller.js`
- [Review model](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/models/review.model.js): `src/models/review.model.js`

### Accounts and Wallet

- [Authentication](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/Auth/routes.js): `src/Auth/routes.js`
- [Auth controller](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/Auth/controller.js): `src/Auth/controller.js`
- [Auth service](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/Auth/service.js): `src/Auth/service.js`
- [Customer profile](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/Customer/routes.js): `src/Customer/routes.js`
- [Customer controller](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/Customer/controller.js): `src/Customer/controller.js`
- [Wallet API](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/Payment/routes.js): `src/Payment/routes.js`
- [Wallet controller](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/Payment/controller.js): `src/Payment/controller.js`
- [Wallet service](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/Payment/service.js): `src/Payment/service.js`

### Rental Commerce

- [Cart API](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/routes/cart.route.js): `src/routes/cart.route.js`
- [Cart and checkout](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/controllers/cart.controller.js): `src/controllers/cart.controller.js`
- [Cart model](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/models/cart.model.js): `src/models/cart.model.js`
- [Orders API](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/routes/order.route.js): `src/routes/order.route.js`
- [Order controller](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/controllers/order.controller.js): `src/controllers/order.controller.js`
- [Order model](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/models/order.model.js): `src/models/order.model.js`

### Catalog Administration

- [Admin API](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/routes/admin.route.js): `src/routes/admin.route.js`
- [Admin controller](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/controllers/admin.controller.js): `src/controllers/admin.controller.js`

### Data and Observability

- [PostgreSQL access](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/models/db.js): `src/models/db.js`
- [Logger](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/utils/logger.js): `src/utils/logger.js`
- [Metrics middleware](https://github.com/asuna-chan123/congnghephanmem/blob/Khoi/src/middleware/metrics.middleware.js): `src/middleware/metrics.middleware.js`

### Other components

- **Customer**
- **Staff**

## Connections

- Customer → Web client: uses
- Web client → Express server: requests
- Express server → Home API: mounts (evidence: `index.js`)
- Express server → Product API: mounts (evidence: `index.js`)
- Product API → Product controller: routes to (evidence: `src/routes/product.route.js`)
- Express server → Favorites API: mounts (evidence: `index.js`)
- Favorites API → Favorites controller: routes to (evidence: `src/routes/favorite.route.js`)
- Express server → Reviews API: mounts (evidence: `index.js`)
- Reviews API → Review controller: routes to (evidence: `src/routes/review.route.js`)
- Review controller → Review model: calls (evidence: `src/controllers/review.controller.js`)
- Express server → Authentication: mounts (evidence: `index.js`)
- Authentication → Auth controller: routes to (evidence: `src/Auth/routes.js`)
- Auth controller → Auth service: calls (evidence: `src/Auth/controller.js`)
- Express server → Customer profile: mounts (evidence: `index.js`)
- Customer profile → Customer controller: routes to (evidence: `src/Customer/routes.js`)
- Express server → Wallet API: mounts (evidence: `index.js`)
- Wallet API → Wallet controller: routes to (evidence: `src/Payment/routes.js`)
- Wallet controller → Wallet service: calls (evidence: `src/Payment/controller.js`)
- Express server → Cart API: mounts (evidence: `index.js`)
- Cart API → Cart and checkout: routes to (evidence: `src/routes/cart.route.js`)
- Cart and checkout → Cart model: calls (evidence: `src/controllers/cart.controller.js`)
- Cart and checkout → Order model: creates order (evidence: `src/controllers/cart.controller.js`)
- Cart and checkout → Wallet service: withdraws funds (evidence: `src/controllers/cart.controller.js`)
- Express server → Orders API: mounts (evidence: `index.js`)
- Orders API → Order controller: routes to (evidence: `src/routes/order.route.js`)
- Order controller → Order model: calls (evidence: `src/controllers/order.controller.js`)
- Express server → Admin API: mounts (evidence: `index.js`)
- Admin API → Admin controller: routes to (evidence: `src/routes/admin.route.js`)
- Admin controller → PostgreSQL access: queries (evidence: `src/controllers/admin.controller.js`)
- Cart model → PostgreSQL access: queries (evidence: `src/models/cart.model.js`)
- Order model → PostgreSQL access: queries (evidence: `src/models/order.model.js`)
- Review model → PostgreSQL access: queries (evidence: `src/models/review.model.js`)
- Express server → Metrics middleware: registers (evidence: `index.js`)
- Express server → Logger: uses (evidence: `index.js`)
- Metrics middleware → Logger: logs through (evidence: `src/middleware/metrics.middleware.js`)
- Staff → Admin API: manages
