# huobin1202/e-mart-c- architecture

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

- Interactive diagram: https://gitdiagram.com/huobin1202/e-mart-c-
- Repository: https://github.com/huobin1202/e-mart-c-

## Overview

Staff E-commerce is a retail operations and online-store system: staff use a protected dashboard for catalog, inventory, orders, point of sale, promotions, purchasing, customers, and reporting; shoppers browse and order through a separate customer app. Backend controllers expose these business capabilities, with services and repositories separating rules from persistence. The excerpts establish routing, selected controller/service and repository/data-layer relationships, and the product data model. The README is empty and most modules are unsampled, so uncertain client-to-server links are shown as unverified rather than asserted.

Main entry points: [`Staff-E-commerce-main/backend/Data/AppDbContext.cs`](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Data/AppDbContext.cs) (Commerce database), [`Staff-E-commerce-main/frontend/src/api/apiClient.js`](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/frontend/src/api/apiClient.js) (API client), [`Staff-E-commerce-main/backend/Models/Order.cs`](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Models/Order.cs) (Order model), [`Staff-E-commerce-main/backend/Controllers/ProductsController.cs`](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/ProductsController.cs) (Product catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_staff["Staff operations"]
  node_staff_app["Staff dashboard<br/>[App.jsx]"]
  node_staff_client["API client<br/>[apiClient.js]"]
end

subgraph group_shopper["Customer storefront"]
  node_customer_app["Customer app<br/>[App.jsx]"]
  node_storefront_api["Storefront API<br/>[storefrontApi.js]"]
end

subgraph group_api["Commerce API"]
  node_product_routes["Product catalog"]
  node_promotion_routes["Promotion management"]
  node_storefront_routes["Storefront orders"]
  node_reports_routes["Reports"]
  node_other_routes["Operations endpoints"]
  node_product_category["Product categories"]
  node_customer_routes["Customer records"]
  node_inventory_routes["Inventory control"]
  node_order_routes["Order processing"]
  node_payment_routes["Payments"]
  node_purchase_routes["Purchase orders"]
  node_import_routes["Bulk import"]
  node_invoice_routes["Invoices"]
  node_stats_routes["Statistics"]
end

subgraph group_domain["Business and persistence"]
  node_product_service["Product service<br/>[ProductService.cs]"]
  node_promotion_service["Promotion rules"]
  node_reports_service["Reports service<br/>[ReportsService.cs]"]
  node_product_repository["Product repository"]
  node_database[("Commerce database<br/>[AppDbContext.cs]")]
  node_product_model["Product model<br/>[Product.cs]"]
  node_order_model["Order model<br/>[Order.cs]"]
  node_customer_model["Customer model<br/>[Customer.cs]"]
  node_promotion_model["Promotion model<br/>[Promotion.cs]"]
  node_inventory_model["Inventory model<br/>[Inventory.cs]"]
  node_category_model["Category model<br/>[Category.cs]"]
  node_user_model["User model<br/>[User.cs]"]
  node_date_helper["Date rules<br/>[DateTimeHelper.cs]"]
end

node_staff_user(("Staff user"))
node_shopper(("Online shopper"))

node_staff_user -->|"uses"| node_staff_app
node_staff_app -.->|"requests data"| node_staff_client
node_shopper -.->|"shops with"| node_customer_app
node_customer_app -->|"uses"| node_storefront_api
node_storefront_api -.->|"calls"| node_storefront_routes
node_staff_client -.->|"calls API"| node_product_routes
node_staff_client -.->|"calls API"| node_promotion_routes
node_staff_client -.->|"calls API"| node_reports_routes
node_product_routes -->|"delegates to"| node_product_service
node_promotion_routes -->|"delegates to"| node_promotion_service
node_reports_routes -->|"delegates to"| node_reports_service
node_product_service -.->|"uses"| node_product_repository
node_promotion_service -->|"uses dates"| node_date_helper
node_promotion_service -->|"maps and validates"| node_promotion_model
node_product_repository -->|"queries and saves"| node_database
node_database -->|"maps entities"| node_product_model
node_database -->|"maps entities"| node_order_model
node_database -.->|"maps entities"| node_customer_model
node_database -.->|"maps entities"| node_promotion_model
node_database -->|"maps entities"| node_inventory_model
node_database -.->|"maps entities"| node_category_model
node_database -.->|"maps entities"| node_user_model
node_product_routes -.->|"serves catalog"| node_product_category
node_customer_routes -.->|"manages"| node_customer_model
node_inventory_routes -.->|"manages"| node_inventory_model
node_order_routes -.->|"manages"| node_order_model
node_payment_routes -.->|"handles order payments"| node_order_model
node_purchase_routes -.->|"supports replenishment"| node_inventory_model
node_import_routes -.->|"imports catalog data"| node_product_repository
node_invoice_routes -.->|"invoices orders"| node_order_model
node_stats_routes -.->|"provides metrics"| node_reports_service

click node_staff_app "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/frontend/src/App.jsx"
click node_staff_client "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/frontend/src/api/apiClient.js"
click node_customer_app "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/customer-app/src/App.jsx"
click node_storefront_api "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/customer-app/src/services/storefrontApi.js"
click node_product_routes "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/ProductsController.cs"
click node_promotion_routes "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/PromotionsController.cs"
click node_storefront_routes "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/StorefrontController.cs"
click node_reports_routes "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/ReportsController.cs"
click node_other_routes "https://github.com/huobin1202/e-mart-c-/tree/main/Staff-E-commerce-main/backend/Controllers"
click node_product_service "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Services/ProductService.cs"
click node_promotion_service "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Services/PromotionService.cs"
click node_reports_service "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Services/ReportsService.cs"
click node_product_repository "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Repository/ProductRepository.cs"
click node_database "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Data/AppDbContext.cs"
click node_product_model "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Models/Product.cs"
click node_order_model "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Models/Order.cs"
click node_customer_model "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Models/Customer.cs"
click node_promotion_model "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Models/Promotion.cs"
click node_inventory_model "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Models/Inventory.cs"
click node_category_model "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Models/Category.cs"
click node_user_model "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Models/User.cs"
click node_date_helper "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Helpers/DateTimeHelper.cs"
click node_product_category "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/CategoriesController.cs"
click node_customer_routes "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/CustomerController.cs"
click node_inventory_routes "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/InventoryController.cs"
click node_order_routes "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/OrdersController.cs"
click node_payment_routes "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/PaymentController.cs"
click node_purchase_routes "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/PurchaseOrdersController.cs"
click node_import_routes "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/ImportController.cs"
click node_invoice_routes "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/InvoiceController.cs"
click node_stats_routes "https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/StatisticsController.cs"

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_staff_app,node_staff_client,node_staff_user toneBlue
class node_customer_app,node_storefront_api toneAmber
class node_product_routes,node_promotion_routes,node_storefront_routes,node_reports_routes,node_other_routes,node_product_category,node_customer_routes,node_inventory_routes,node_order_routes,node_payment_routes,node_purchase_routes,node_import_routes,node_invoice_routes,node_stats_routes toneMint
class node_product_service,node_promotion_service,node_reports_service,node_product_repository,node_database,node_product_model,node_order_model,node_customer_model,node_promotion_model,node_inventory_model,node_category_model,node_user_model,node_date_helper toneRose
class node_shopper toneIndigo
```

## Components

### Staff operations

- [Staff dashboard](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/frontend/src/App.jsx): `Staff-E-commerce-main/frontend/src/App.jsx`
- [API client](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/frontend/src/api/apiClient.js): `Staff-E-commerce-main/frontend/src/api/apiClient.js`

### Customer storefront

- [Customer app](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/customer-app/src/App.jsx): `Staff-E-commerce-main/customer-app/src/App.jsx`
- [Storefront API](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/customer-app/src/services/storefrontApi.js): `Staff-E-commerce-main/customer-app/src/services/storefrontApi.js`

### Commerce API

- [Product catalog](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/ProductsController.cs): `Staff-E-commerce-main/backend/Controllers/ProductsController.cs`
- [Promotion management](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/PromotionsController.cs): `Staff-E-commerce-main/backend/Controllers/PromotionsController.cs`
- [Storefront orders](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/StorefrontController.cs): `Staff-E-commerce-main/backend/Controllers/StorefrontController.cs`
- [Reports](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/ReportsController.cs): `Staff-E-commerce-main/backend/Controllers/ReportsController.cs`
- [Operations endpoints](https://github.com/huobin1202/e-mart-c-/tree/main/Staff-E-commerce-main/backend/Controllers): `Staff-E-commerce-main/backend/Controllers`
- [Product categories](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/CategoriesController.cs): `Staff-E-commerce-main/backend/Controllers/CategoriesController.cs`
- [Customer records](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/CustomerController.cs): `Staff-E-commerce-main/backend/Controllers/CustomerController.cs`
- [Inventory control](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/InventoryController.cs): `Staff-E-commerce-main/backend/Controllers/InventoryController.cs`
- [Order processing](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/OrdersController.cs): `Staff-E-commerce-main/backend/Controllers/OrdersController.cs`
- [Payments](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/PaymentController.cs): `Staff-E-commerce-main/backend/Controllers/PaymentController.cs`
- [Purchase orders](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/PurchaseOrdersController.cs): `Staff-E-commerce-main/backend/Controllers/PurchaseOrdersController.cs`
- [Bulk import](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/ImportController.cs): `Staff-E-commerce-main/backend/Controllers/ImportController.cs`
- [Invoices](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/InvoiceController.cs): `Staff-E-commerce-main/backend/Controllers/InvoiceController.cs`
- [Statistics](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Controllers/StatisticsController.cs): `Staff-E-commerce-main/backend/Controllers/StatisticsController.cs`

### Business and persistence

- [Product service](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Services/ProductService.cs): `Staff-E-commerce-main/backend/Services/ProductService.cs`
- [Promotion rules](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Services/PromotionService.cs): `Staff-E-commerce-main/backend/Services/PromotionService.cs`
- [Reports service](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Services/ReportsService.cs): `Staff-E-commerce-main/backend/Services/ReportsService.cs`
- [Product repository](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Repository/ProductRepository.cs): `Staff-E-commerce-main/backend/Repository/ProductRepository.cs`
- [Commerce database](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Data/AppDbContext.cs): `Staff-E-commerce-main/backend/Data/AppDbContext.cs`
- [Product model](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Models/Product.cs): `Staff-E-commerce-main/backend/Models/Product.cs`
- [Order model](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Models/Order.cs): `Staff-E-commerce-main/backend/Models/Order.cs`
- [Customer model](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Models/Customer.cs): `Staff-E-commerce-main/backend/Models/Customer.cs`
- [Promotion model](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Models/Promotion.cs): `Staff-E-commerce-main/backend/Models/Promotion.cs`
- [Inventory model](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Models/Inventory.cs): `Staff-E-commerce-main/backend/Models/Inventory.cs`
- [Category model](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Models/Category.cs): `Staff-E-commerce-main/backend/Models/Category.cs`
- [User model](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Models/User.cs): `Staff-E-commerce-main/backend/Models/User.cs`
- [Date rules](https://github.com/huobin1202/e-mart-c-/blob/main/Staff-E-commerce-main/backend/Helpers/DateTimeHelper.cs): `Staff-E-commerce-main/backend/Helpers/DateTimeHelper.cs`

### Other components

- **Staff user**
- **Online shopper**

## Connections

- Staff user → Staff dashboard: uses (evidence: `Staff-E-commerce-main/frontend/src/App.jsx`)
- Staff dashboard → API client: requests data
- Online shopper → Customer app: shops with
- Customer app → Storefront API: uses
- Storefront API → Storefront orders: calls
- API client → Product catalog: calls API
- API client → Promotion management: calls API
- API client → Reports: calls API
- Product catalog → Product service: delegates to (evidence: `Staff-E-commerce-main/backend/Controllers/ProductsController.cs`)
- Promotion management → Promotion rules: delegates to (evidence: `Staff-E-commerce-main/backend/Controllers/PromotionsController.cs`)
- Reports → Reports service: delegates to (evidence: `Staff-E-commerce-main/backend/Controllers/ReportsController.cs`)
- Product service → Product repository: uses (evidence: `Staff-E-commerce-main/backend/Services/ProductService.cs`)
- Promotion rules → Date rules: uses dates (evidence: `Staff-E-commerce-main/backend/Services/PromotionService.cs`)
- Promotion rules → Promotion model: maps and validates (evidence: `Staff-E-commerce-main/backend/Services/PromotionService.cs`)
- Product repository → Commerce database: queries and saves (evidence: `Staff-E-commerce-main/backend/Repository/ProductRepository.cs`)
- Commerce database → Product model: maps entities (evidence: `Staff-E-commerce-main/backend/Data/AppDbContext.cs`)
- Commerce database → Order model: maps entities (evidence: `Staff-E-commerce-main/backend/Data/AppDbContext.cs`)
- Commerce database → Customer model: maps entities (evidence: `Staff-E-commerce-main/backend/Data/AppDbContext.cs`)
- Commerce database → Promotion model: maps entities (evidence: `Staff-E-commerce-main/backend/Data/AppDbContext.cs`)
- Commerce database → Inventory model: maps entities (evidence: `Staff-E-commerce-main/backend/Data/AppDbContext.cs`)
- Commerce database → Category model: maps entities (evidence: `Staff-E-commerce-main/backend/Data/AppDbContext.cs`)
- Commerce database → User model: maps entities (evidence: `Staff-E-commerce-main/backend/Data/AppDbContext.cs`)
- Product catalog → Product categories: serves catalog
- Customer records → Customer model: manages
- Inventory control → Inventory model: manages
- Order processing → Order model: manages
- Payments → Order model: handles order payments
- Purchase orders → Inventory model: supports replenishment
- Bulk import → Product repository: imports catalog data
- Invoices → Order model: invoices orders
- Statistics → Reports service: provides metrics
