# wecdiet/crm architecture

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

- Interactive diagram: https://gitdiagram.com/wecdiet/crm
- Repository: https://github.com/wecdiet/crm

## Overview

This is a Spring-based retail CRM and commerce backend: it exposes staff and customer APIs for catalog, checkout/orders, stock, procurement/transfers, shipping, and workforce administration. The central customer journey is product discovery through checkout to order fulfillment; staff workflows maintain inventory and purchasing alongside it. The graph preserves these separate domain stages and a persistence layer. Source excerpts show service dependencies and entity/repository structure, but the README is empty and controllers were not sampled, so API routing and several runtime handoffs are shown only as unverified dashed links.

Main entry points: [`src/main/java/com/CRM/services/Product/ProductService.java`](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/Product/ProductService.java) (Product catalog), [`src/main/java/com/CRM/services/CheckOut/CheckOutService.java`](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/CheckOut/CheckOutService.java) (Checkout), [`src/main/java/com/CRM/services/Order/OrderService.java`](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/Order/OrderService.java) (Order processing), [`src/main/java/com/CRM/controllers/AuthController.java`](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/controllers/AuthController.java) (Authentication API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and identity"]
  node_auth_api["Authentication API"]
  node_auth_service["Authentication<br/>[AuthService.java]"]
end

subgraph group_commerce["Catalog and commerce"]
  node_product_api["Product API"]
  node_product_service["Product catalog"]
  node_cart_api["Cart API"]
  node_cart_service["Cart handling<br/>[CartService.java]"]
  node_checkout_api["Checkout API"]
  node_checkout_service["Checkout"]
  node_orders["Order processing<br/>[OrderService.java]"]
  node_payments["Payment gateway<br/>[VNPayService.java]"]
end

subgraph group_operations["Inventory operations"]
  node_purchasing["Purchase orders"]
  node_transfers["Stock transfers"]
  node_inventory["Inventory management"]
  node_shipping["Shipping integration<br/>[GHNService.java]"]
end

subgraph group_workforce["Workforce administration"]
  node_employees["Employee contracts"]
  node_hr_api["Workforce APIs"]
end

subgraph group_persistence["Persistence and integrations"]
  node_sql_store[("Relational data")]
  node_product_model["Product and stock model<br/>[Product.java]"]
  node_store_model["Store model<br/>[Store.java]"]
  node_mongo_store[("Commerce documents<br/>[Cart.java]")]
  node_media["Media uploads"]
end

node_customer(("Customer"))
node_staff(("Staff user"))

node_customer -.->|"signs in"| node_auth_api
node_auth_api -.->|"delegates"| node_auth_service
node_customer -.->|"browses"| node_product_api
node_product_api -.->|"queries catalog"| node_product_service
node_product_service -.->|"reads products"| node_sql_store
node_product_model -.->|"stored through"| node_sql_store
node_customer -.->|"updates cart"| node_cart_api
node_cart_api -.->|"delegates"| node_cart_service
node_cart_service -.->|"persists cart"| node_mongo_store
node_customer -.->|"checks out"| node_checkout_api
node_checkout_api -.->|"starts checkout"| node_checkout_service
node_checkout_service -.->|"creates order"| node_orders
node_checkout_service -.->|"reads checkout state"| node_mongo_store
node_orders -.->|"requests payment"| node_payments
node_orders -.->|"coordinates delivery"| node_shipping
node_staff -.->|"manages staff"| node_hr_api
node_hr_api -.->|"delegates"| node_employees
node_staff -.->|"manages procurement"| node_purchasing
node_staff -.->|"moves stock"| node_transfers
node_purchasing -.->|"updates stock"| node_inventory
node_transfers -.->|"updates stock"| node_inventory
node_shipping -.->|"uses store details"| node_store_model
node_product_service -.->|"uses product media"| node_media

click node_auth_api "https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/controllers/AuthController.java"
click node_auth_service "https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/Auth/AuthService.java"
click node_product_api "https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/controllers/Customer/ProductCustomerController.java"
click node_product_service "https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/Product/ProductService.java"
click node_cart_api "https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/controllers/CartController.java"
click node_cart_service "https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/Cart/CartService.java"
click node_checkout_api "https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/controllers/Customer/CheckoutController.java"
click node_checkout_service "https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/CheckOut/CheckOutService.java"
click node_orders "https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/Order/OrderService.java"
click node_payments "https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/VNPay/VNPayService.java"
click node_purchasing "https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/PurchaseOrder/PurchaseOrderService.java"
click node_transfers "https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/TransferTicket/TransferTicketService.java"
click node_inventory "https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/Inventory/InventoryService.java"
click node_shipping "https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/GHN/GHNService.java"
click node_employees "https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/EmployeeContact/EmployeeContactService.java"
click node_hr_api "https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/controllers/EmployeeController.java"
click node_sql_store "https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/repositories/IProductRepository.java"
click node_product_model "https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/models/Product.java"
click node_store_model "https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/models/Store.java"
click node_mongo_store "https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/models/mongoDB/Cart.java"
click node_media "https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/Cloudinary/CloudinaryService.java"

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_auth_api,node_auth_service,node_staff toneBlue
class node_product_api,node_product_service,node_cart_api,node_cart_service,node_checkout_api,node_checkout_service,node_orders,node_payments toneAmber
class node_purchasing,node_transfers,node_inventory,node_shipping toneMint
class node_employees,node_hr_api toneRose
class node_sql_store,node_product_model,node_store_model,node_mongo_store,node_media,node_customer toneIndigo
```

## Components

### API and identity

- [Authentication API](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/controllers/AuthController.java): `src/main/java/com/CRM/controllers/AuthController.java`
- [Authentication](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/Auth/AuthService.java): `src/main/java/com/CRM/services/Auth/AuthService.java`

### Catalog and commerce

- [Product API](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/controllers/Customer/ProductCustomerController.java): `src/main/java/com/CRM/controllers/Customer/ProductCustomerController.java`
- [Product catalog](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/Product/ProductService.java): `src/main/java/com/CRM/services/Product/ProductService.java`
- [Cart API](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/controllers/CartController.java): `src/main/java/com/CRM/controllers/CartController.java`
- [Cart handling](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/Cart/CartService.java): `src/main/java/com/CRM/services/Cart/CartService.java`
- [Checkout API](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/controllers/Customer/CheckoutController.java): `src/main/java/com/CRM/controllers/Customer/CheckoutController.java`
- [Checkout](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/CheckOut/CheckOutService.java): `src/main/java/com/CRM/services/CheckOut/CheckOutService.java`
- [Order processing](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/Order/OrderService.java): `src/main/java/com/CRM/services/Order/OrderService.java`
- [Payment gateway](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/VNPay/VNPayService.java): `src/main/java/com/CRM/services/VNPay/VNPayService.java`

### Inventory operations

- [Purchase orders](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/PurchaseOrder/PurchaseOrderService.java): `src/main/java/com/CRM/services/PurchaseOrder/PurchaseOrderService.java`
- [Stock transfers](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/TransferTicket/TransferTicketService.java): `src/main/java/com/CRM/services/TransferTicket/TransferTicketService.java`
- [Inventory management](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/Inventory/InventoryService.java): `src/main/java/com/CRM/services/Inventory/InventoryService.java`
- [Shipping integration](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/GHN/GHNService.java): `src/main/java/com/CRM/services/GHN/GHNService.java`

### Workforce administration

- [Employee contracts](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/EmployeeContact/EmployeeContactService.java): `src/main/java/com/CRM/services/EmployeeContact/EmployeeContactService.java`
- [Workforce APIs](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/controllers/EmployeeController.java): `src/main/java/com/CRM/controllers/EmployeeController.java`

### Persistence and integrations

- [Relational data](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/repositories/IProductRepository.java): `src/main/java/com/CRM/repositories/IProductRepository.java`
- [Product and stock model](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/models/Product.java): `src/main/java/com/CRM/models/Product.java`
- [Store model](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/models/Store.java): `src/main/java/com/CRM/models/Store.java`
- [Commerce documents](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/models/mongoDB/Cart.java): `src/main/java/com/CRM/models/mongoDB/Cart.java`
- [Media uploads](https://github.com/wecdiet/crm/blob/main/src/main/java/com/CRM/services/Cloudinary/CloudinaryService.java): `src/main/java/com/CRM/services/Cloudinary/CloudinaryService.java`

### Other components

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

## Connections

- Customer → Authentication API: signs in
- Authentication API → Authentication: delegates
- Customer → Product API: browses
- Product API → Product catalog: queries catalog
- Product catalog → Relational data: reads products (evidence: `src/main/java/com/CRM/services/Product/ProductService.java`)
- Product and stock model → Relational data: stored through (evidence: `src/main/java/com/CRM/repositories/IProductRepository.java`)
- Customer → Cart API: updates cart
- Cart API → Cart handling: delegates
- Cart handling → Commerce documents: persists cart
- Customer → Checkout API: checks out
- Checkout API → Checkout: starts checkout
- Checkout → Order processing: creates order
- Checkout → Commerce documents: reads checkout state (evidence: `src/main/java/com/CRM/services/CheckOut/CheckOutService.java`)
- Order processing → Payment gateway: requests payment
- Order processing → Shipping integration: coordinates delivery
- Staff user → Workforce APIs: manages staff
- Workforce APIs → Employee contracts: delegates
- Staff user → Purchase orders: manages procurement
- Staff user → Stock transfers: moves stock
- Purchase orders → Inventory management: updates stock
- Stock transfers → Inventory management: updates stock
- Shipping integration → Store model: uses store details (evidence: `src/main/java/com/CRM/services/GHN/GHNService.java`)
- Product catalog → Media uploads: uses product media (evidence: `src/main/java/com/CRM/services/Product/ProductService.java`)
