# aliyavarguluzada/ecommerce architecture

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

- Interactive diagram: https://gitdiagram.com/aliyavarguluzada/ecommerce
- Repository: https://github.com/aliyavarguluzada/ecommerce

## Overview

This is a multi-service commerce application with a storefront/admin workspace and authenticated APIs. The main customer workflow is storefront access, catalog browsing, cart management, checkout into an order, inventory reservation, and payment; order and payment recovery support unfinished workflows. The README documents the service map, while excerpts and the source index confirm several controller-to-service and service-to-domain interactions. Some cross-service links and persistence details are documented rather than verified from sampled callers.

Main entry points: [`src/ECommerce.ApiGateway/Program.cs`](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.ApiGateway/Program.cs) (API gateway), [`src/ECommerce.Order.Application/OrderService.cs`](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Order.Application/OrderService.cs) (Order coordination), [`src/ECommerce.Cart.Application/CartService.cs`](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Cart.Application/CartService.cs) (Cart and checkout), [`src/ECommerce.Payment.Application/PaymentService.cs`](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Payment.Application/PaymentService.cs) (Payment processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Storefront and identity"]
  node_gateway["API gateway<br/>[Program.cs]"]
  node_storefront["Storefront workspace<br/>[app.js]"]
  node_identity_api["Identity API"]
  node_identity_service["Identity service<br/>[IdentityService.cs]"]
  node_identity_db[("Identity database")]
  node_security["Token security"]
end

subgraph group_catalog["Catalog management"]
  node_product_api["Product API"]
  node_category_api["Category API"]
  node_catalog_handlers["Catalog handlers"]
  node_catalog_domain["Product and category rules<br/>[Product.cs]"]
  node_catalog_store[("Catalog persistence")]
end

subgraph group_commerce["Cart and orders"]
  node_cart_api["Cart API<br/>[CartController.cs]"]
  node_cart_service["Cart and checkout<br/>[CartService.cs]"]
  node_cart_domain["Shopping cart state<br/>[ShoppingCart.cs]"]
  node_cart_db[("Cart database<br/>[CartDbContext.cs]")]
  node_order_api["Order API"]
  node_order_service["Order coordination<br/>[OrderService.cs]"]
  node_order_domain["Order lifecycle<br/>[PurchaseOrder.cs]"]
  node_order_db[("Order database<br/>[OrderDbContext.cs]")]
  node_order_recovery["Order recovery"]
end

subgraph group_inventory["Inventory"]
  node_inventory_api["Inventory API"]
  node_inventory_service["Stock and reservations"]
  node_inventory_db[("Inventory database")]
end

subgraph group_payments["Payments"]
  node_payment_api["Payment API"]
  node_payment_service["Payment processing<br/>[PaymentService.cs]"]
  node_payment_db[("Payment database")]
  node_provider["Development payment provider"]
  node_payment_recovery["Payment recovery"]
end

node_customer(("Customer"))
node_admin(("Administrator"))

node_customer -->|"uses"| node_storefront
node_admin -->|"manages through"| node_storefront
node_storefront -.->|"accesses"| node_gateway
node_customer -->|"requests APIs"| node_gateway
node_admin -->|"requests APIs"| node_gateway
node_gateway -->|"routes requests"| node_identity_api
node_gateway -->|"routes requests"| node_product_api
node_gateway -->|"routes requests"| node_category_api
node_gateway -->|"routes requests"| node_cart_api
node_gateway -->|"routes requests"| node_order_api
node_gateway -->|"routes requests"| node_inventory_api
node_gateway -->|"routes requests"| node_payment_api
node_identity_api -->|"delegates identity"| node_identity_service
node_identity_service -->|"reads and writes"| node_identity_db
node_security -->|"secures endpoints"| node_identity_api
node_product_api -->|"dispatches requests"| node_catalog_handlers
node_category_api -->|"dispatches requests"| node_catalog_handlers
node_catalog_handlers -.->|"applies rules"| node_catalog_domain
node_catalog_handlers -.->|"persists catalog"| node_catalog_store
node_cart_api -->|"calls service"| node_cart_service
node_cart_service -->|"updates cart state"| node_cart_domain
node_cart_service -.->|"stores cart state"| node_cart_db
node_cart_service -.->|"checks products"| node_product_api
node_cart_service -.->|"creates orders"| node_order_api
node_order_api -->|"calls service"| node_order_service
node_order_service -->|"advances lifecycle"| node_order_domain
node_order_service -.->|"stores order state"| node_order_db
node_order_service -.->|"gets product data"| node_product_api
node_order_service -.->|"reserves stock"| node_inventory_api
node_order_service -.->|"requests refunds"| node_payment_api
node_order_recovery -->|"retries workflows"| node_order_service
node_inventory_api -->|"calls service"| node_inventory_service
node_inventory_service -.->|"stores stock state"| node_inventory_db
node_payment_api -->|"calls service"| node_payment_service
node_payment_service -.->|"stores payment state"| node_payment_db
node_payment_service -.->|"processes charges"| node_provider
node_payment_service -.->|"confirms payment"| node_order_api
node_payment_recovery -.->|"recovers payments"| node_payment_service

click node_gateway "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.ApiGateway/Program.cs"
click node_storefront "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.ApiGateway/wwwroot/shop/app.js"
click node_identity_api "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Identity.Api/Controllers/IdentityController.cs"
click node_identity_service "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Identity.Infrastructure/IdentityService.cs"
click node_identity_db "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Identity.Infrastructure/IdentityDbContext.cs"
click node_security "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Security/SecurityExtensions.cs"
click node_product_api "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Catalog.Api/Products/ProductController.cs"
click node_category_api "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Catalog.Api/Categories/CategoryController.cs"
click node_catalog_handlers "https://github.com/aliyavarguluzada/ecommerce/tree/master/src/ECommerce.Catalog.Application"
click node_catalog_domain "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Catalog.Domain/Aggregates/Products/Product.cs"
click node_catalog_store "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Catalog.Infrastructure/Persistence/CatalogDbContext.cs"
click node_cart_api "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Cart.Api/Controllers/CartController.cs"
click node_cart_service "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Cart.Application/CartService.cs"
click node_cart_domain "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Cart.Domain/ShoppingCart.cs"
click node_cart_db "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Cart.Infrastructure/CartDbContext.cs"
click node_order_api "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Order.Api/Controllers/OrdersController.cs"
click node_order_service "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Order.Application/OrderService.cs"
click node_order_domain "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Order.Domain/PurchaseOrder.cs"
click node_order_db "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Order.Infrastructure/OrderDbContext.cs"
click node_order_recovery "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Order.Api/Common/OrderRecoveryWorker.cs"
click node_inventory_api "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Inventory.Api/Controllers/ReservationsController.cs"
click node_inventory_service "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Inventory.Application/InventoryService.cs"
click node_inventory_db "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Inventory.Infrastructure/InventoryDbContext.cs"
click node_payment_api "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Payment.Api/Controllers/PaymentsController.cs"
click node_payment_service "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Payment.Application/PaymentService.cs"
click node_payment_db "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Payment.Infrastructure/PaymentDbContext.cs"
click node_provider "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Payment.Infrastructure/DevelopmentPaymentProvider.cs"
click node_payment_recovery "https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Payment.Api/Common/PaymentRecoveryWorker.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_gateway,node_storefront,node_identity_api,node_identity_service,node_identity_db,node_security toneBlue
class node_product_api,node_category_api,node_catalog_handlers,node_catalog_domain,node_catalog_store toneAmber
class node_cart_api,node_cart_service,node_cart_domain,node_cart_db,node_order_api,node_order_service,node_order_domain,node_order_db,node_order_recovery toneMint
class node_inventory_api,node_inventory_service,node_inventory_db toneRose
class node_payment_api,node_payment_service,node_payment_db,node_provider,node_payment_recovery,node_customer,node_admin toneIndigo
```

## Components

### Storefront and identity

- [API gateway](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.ApiGateway/Program.cs): `src/ECommerce.ApiGateway/Program.cs`
- [Storefront workspace](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.ApiGateway/wwwroot/shop/app.js): `src/ECommerce.ApiGateway/wwwroot/shop/app.js`
- [Identity API](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Identity.Api/Controllers/IdentityController.cs): `src/ECommerce.Identity.Api/Controllers/IdentityController.cs`
- [Identity service](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Identity.Infrastructure/IdentityService.cs): `src/ECommerce.Identity.Infrastructure/IdentityService.cs`
- [Identity database](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Identity.Infrastructure/IdentityDbContext.cs): `src/ECommerce.Identity.Infrastructure/IdentityDbContext.cs`
- [Token security](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Security/SecurityExtensions.cs): `src/ECommerce.Security/SecurityExtensions.cs`

### Catalog management

- [Product API](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Catalog.Api/Products/ProductController.cs): `src/ECommerce.Catalog.Api/Products/ProductController.cs`
- [Category API](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Catalog.Api/Categories/CategoryController.cs): `src/ECommerce.Catalog.Api/Categories/CategoryController.cs`
- [Catalog handlers](https://github.com/aliyavarguluzada/ecommerce/tree/master/src/ECommerce.Catalog.Application): `src/ECommerce.Catalog.Application`
- [Product and category rules](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Catalog.Domain/Aggregates/Products/Product.cs): `src/ECommerce.Catalog.Domain/Aggregates/Products/Product.cs`
- [Catalog persistence](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Catalog.Infrastructure/Persistence/CatalogDbContext.cs): `src/ECommerce.Catalog.Infrastructure/Persistence/CatalogDbContext.cs`

### Cart and orders

- [Cart API](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Cart.Api/Controllers/CartController.cs): `src/ECommerce.Cart.Api/Controllers/CartController.cs`
- [Cart and checkout](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Cart.Application/CartService.cs): `src/ECommerce.Cart.Application/CartService.cs`
- [Shopping cart state](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Cart.Domain/ShoppingCart.cs): `src/ECommerce.Cart.Domain/ShoppingCart.cs`
- [Cart database](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Cart.Infrastructure/CartDbContext.cs): `src/ECommerce.Cart.Infrastructure/CartDbContext.cs`
- [Order API](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Order.Api/Controllers/OrdersController.cs): `src/ECommerce.Order.Api/Controllers/OrdersController.cs`
- [Order coordination](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Order.Application/OrderService.cs): `src/ECommerce.Order.Application/OrderService.cs`
- [Order lifecycle](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Order.Domain/PurchaseOrder.cs): `src/ECommerce.Order.Domain/PurchaseOrder.cs`
- [Order database](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Order.Infrastructure/OrderDbContext.cs): `src/ECommerce.Order.Infrastructure/OrderDbContext.cs`
- [Order recovery](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Order.Api/Common/OrderRecoveryWorker.cs): `src/ECommerce.Order.Api/Common/OrderRecoveryWorker.cs`

### Inventory

- [Inventory API](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Inventory.Api/Controllers/ReservationsController.cs): `src/ECommerce.Inventory.Api/Controllers/ReservationsController.cs`
- [Stock and reservations](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Inventory.Application/InventoryService.cs): `src/ECommerce.Inventory.Application/InventoryService.cs`
- [Inventory database](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Inventory.Infrastructure/InventoryDbContext.cs): `src/ECommerce.Inventory.Infrastructure/InventoryDbContext.cs`

### Payments

- [Payment API](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Payment.Api/Controllers/PaymentsController.cs): `src/ECommerce.Payment.Api/Controllers/PaymentsController.cs`
- [Payment processing](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Payment.Application/PaymentService.cs): `src/ECommerce.Payment.Application/PaymentService.cs`
- [Payment database](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Payment.Infrastructure/PaymentDbContext.cs): `src/ECommerce.Payment.Infrastructure/PaymentDbContext.cs`
- [Development payment provider](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Payment.Infrastructure/DevelopmentPaymentProvider.cs): `src/ECommerce.Payment.Infrastructure/DevelopmentPaymentProvider.cs`
- [Payment recovery](https://github.com/aliyavarguluzada/ecommerce/blob/master/src/ECommerce.Payment.Api/Common/PaymentRecoveryWorker.cs): `src/ECommerce.Payment.Api/Common/PaymentRecoveryWorker.cs`

### Other components

- **Customer**
- **Administrator**

## Connections

- Customer → Storefront workspace: uses (evidence: `README.md`)
- Administrator → Storefront workspace: manages through (evidence: `README.md`)
- Storefront workspace → API gateway: accesses
- Customer → API gateway: requests APIs (evidence: `README.md`)
- Administrator → API gateway: requests APIs (evidence: `README.md`)
- API gateway → Identity API: routes requests (evidence: `README.md`)
- API gateway → Product API: routes requests (evidence: `README.md`)
- API gateway → Category API: routes requests (evidence: `README.md`)
- API gateway → Cart API: routes requests (evidence: `README.md`)
- API gateway → Order API: routes requests (evidence: `README.md`)
- API gateway → Inventory API: routes requests (evidence: `README.md`)
- API gateway → Payment API: routes requests (evidence: `README.md`)
- Identity API → Identity service: delegates identity (evidence: `README.md`)
- Identity service → Identity database: reads and writes (evidence: `README.md`)
- Token security → Identity API: secures endpoints (evidence: `README.md`)
- Product API → Catalog handlers: dispatches requests (evidence: `src/ECommerce.Catalog.Api/Products/ProductController.cs`)
- Category API → Catalog handlers: dispatches requests (evidence: `src/ECommerce.Catalog.Api/Categories/CategoryController.cs`)
- Catalog handlers → Product and category rules: applies rules (evidence: `src/ECommerce.Catalog.Application/Products/Commands/CreateProduct/CreateProductHandler.cs`)
- Catalog handlers → Catalog persistence: persists catalog
- Cart API → Cart and checkout: calls service (evidence: `src/ECommerce.Cart.Api/Controllers/CartController.cs`)
- Cart and checkout → Shopping cart state: updates cart state (evidence: `src/ECommerce.Cart.Application/CartService.cs`)
- Cart and checkout → Cart database: stores cart state
- Cart and checkout → Product API: checks products
- Cart and checkout → Order API: creates orders (evidence: `src/ECommerce.Order.Api/Controllers/OrdersController.cs`)
- Order API → Order coordination: calls service (evidence: `src/ECommerce.Order.Api/Controllers/OrdersController.cs`)
- Order coordination → Order lifecycle: advances lifecycle (evidence: `src/ECommerce.Order.Application/OrderService.cs`)
- Order coordination → Order database: stores order state
- Order coordination → Product API: gets product data
- Order coordination → Inventory API: reserves stock
- Order coordination → Payment API: requests refunds (evidence: `src/ECommerce.Payment.Api/Controllers/PaymentsController.cs`)
- Order recovery → Order coordination: retries workflows (evidence: `README.md`)
- Inventory API → Stock and reservations: calls service
- Stock and reservations → Inventory database: stores stock state
- Payment API → Payment processing: calls service (evidence: `src/ECommerce.Payment.Api/Controllers/PaymentsController.cs`)
- Payment processing → Payment database: stores payment state
- Payment processing → Development payment provider: processes charges
- Payment processing → Order API: confirms payment (evidence: `src/ECommerce.Order.Api/Controllers/OrdersController.cs`)
- Payment recovery → Payment processing: recovers payments (evidence: `src/ECommerce.Payment.Api/Common/PaymentRecoveryWorker.cs`)
