# moaazalaa12/ecommerce-cleanarchitecture architecture

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

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

## Overview

This is a Clean Architecture e-commerce API. Its clearest runtime path is order creation and retrieval through the Orders API into application handlers and domain repositories; the sampled payment path loads an order, asks the payment service to create/update a Stripe intent, and updates the order’s payment record. The tree also includes catalog, identity, and notification domain models. Redis caching and SignalR are README capabilities, but their implementation files are not present in the supplied tree, so those branches are shown only as unverified capabilities.

Main entry points: [`src/ECommerce.Infrastructure/Repositories/OrderRepository.cs`](https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Infrastructure/Repositories/OrderRepository.cs) (Order repository), [`src/ECommerce.Application/Features/Payments/Commands`](https://github.com/moaazalaa12/ecommerce-cleanarchitecture/tree/main/src/ECommerce.Application/Features/Payments/Commands) (Payment commands), [`src/ECommerce.WebAPI/Controllers/OrdersController.cs`](https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.WebAPI/Controllers/OrdersController.cs) (Orders API), [`src/ECommerce.Application/Features/Orders/Queries`](https://github.com/moaazalaa12/ecommerce-cleanarchitecture/tree/main/src/ECommerce.Application/Features/Orders/Queries) (Order queries)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API entry points"]
  node_orders_api["Orders API"]
  node_payments_api["Payments API"]
  node_webhooks["Payment webhooks"]
end

subgraph group_application["Application workflows"]
  node_order_commands["Order commands<br/>[Commands]"]
  node_order_queries["Order queries<br/>[Queries]"]
  node_create_order_handler["Create order"]
  node_get_order_handler["Get order"]
  node_get_user_orders_handler["List user orders"]
  node_payment_commands["Payment commands<br/>[Commands]"]
  node_create_payment_handler["Create payment intent"]
  node_refund_handler["Refund payment"]
  node_payment_status_handler["Update payment status"]
end

subgraph group_domain["Commerce domain"]
  node_orders["Orders and payments<br/>[Order.cs]"]
  node_catalog["Product catalog<br/>[Product.cs]"]
  node_reviews["Product reviews<br/>[Review.cs]"]
end

subgraph group_infrastructure["Infrastructure"]
  node_identity["Identity service<br/>[IdentityService.cs]"]
  node_order_repository["Order repository<br/>[OrderRepository.cs]"]
  node_product_repository["Product repository"]
  node_payment_service["Payment service<br/>[PaymentService.cs]"]
  node_database[("Application database")]
end

node_customer(("Customer"))
node_stripe["Stripe"]
node_redis[("Redis caching")]
node_signalr["SignalR notifications"]

node_customer -->|"requests"| node_orders_api
node_customer -->|"requests"| node_payments_api
node_orders_api -.->|"dispatches"| node_order_commands
node_orders_api -.->|"dispatches"| node_order_queries
node_payments_api -.->|"dispatches"| node_payment_commands
node_webhooks -.->|"dispatches"| node_payment_status_handler
node_order_commands -.->|"handles"| node_create_order_handler
node_order_queries -.->|"handles"| node_get_order_handler
node_order_queries -.->|"handles"| node_get_user_orders_handler
node_payment_commands -.->|"handles"| node_create_payment_handler
node_payment_commands -.->|"handles"| node_refund_handler
node_payment_commands -.->|"handles"| node_payment_status_handler
node_create_order_handler -->|"reads and writes"| node_order_repository
node_create_order_handler -->|"reads products"| node_product_repository
node_get_order_handler -->|"loads order"| node_order_repository
node_get_user_orders_handler -->|"loads page"| node_order_repository
node_create_payment_handler -->|"loads order"| node_order_repository
node_create_payment_handler -->|"requests intent"| node_payment_service
node_order_repository -->|"queries"| node_database
node_product_repository -->|"queries"| node_database
node_payment_service -.->|"integrates"| node_stripe
node_customer -.->|"uses caching"| node_redis
node_signalr -.->|"notifies"| node_customer

click node_orders_api "https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.WebAPI/Controllers/OrdersController.cs"
click node_payments_api "https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.WebAPI/Controllers/PaymentsController.cs"
click node_webhooks "https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.WebAPI/Controllers/WebhooksController.cs"
click node_order_commands "https://github.com/moaazalaa12/ecommerce-cleanarchitecture/tree/main/src/ECommerce.Application/Features/Orders/Commands"
click node_order_queries "https://github.com/moaazalaa12/ecommerce-cleanarchitecture/tree/main/src/ECommerce.Application/Features/Orders/Queries"
click node_create_order_handler "https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Application/Features/Orders/Commands/CreateOrder/CreateOrderCommandHandler.cs"
click node_get_order_handler "https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Application/Features/Orders/Queries/GetOrderById/GetOrderByIdQueryHandler.cs"
click node_get_user_orders_handler "https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Application/Features/Orders/Queries/GetUserOrders/GetUserOrdersQueryHandler.cs"
click node_payment_commands "https://github.com/moaazalaa12/ecommerce-cleanarchitecture/tree/main/src/ECommerce.Application/Features/Payments/Commands"
click node_create_payment_handler "https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Application/Features/Payments/Commands/CreatePaymentIntent/CreatePaymentIntentCommandHandler.cs"
click node_refund_handler "https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Application/Features/Payments/Commands/RefundPayment/RefundPaymentCommandHandler.cs"
click node_payment_status_handler "https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Application/Features/Payments/Commands/UpdatePaymentStatus/UpdatePaymentStatusCommandHandler.cs"
click node_orders "https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Domain/Entities/OrderEntities/Order.cs"
click node_catalog "https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Domain/Entities/CatalogEntities/Product.cs"
click node_reviews "https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Domain/Entities/CatalogEntities/Review.cs"
click node_identity "https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Infrastructure/Identity/IdentityService.cs"
click node_order_repository "https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Infrastructure/Repositories/OrderRepository.cs"
click node_product_repository "https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Infrastructure/Repositories/ProductRepository.cs"
click node_payment_service "https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Infrastructure/ExternalServices/Payment/PaymentService.cs"
click node_database "https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Infrastructure/Persistence/DbContext/ApplicationDbContext.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_orders_api,node_payments_api,node_webhooks toneBlue
class node_order_commands,node_order_queries,node_create_order_handler,node_get_order_handler,node_get_user_orders_handler,node_payment_commands,node_create_payment_handler,node_refund_handler,node_payment_status_handler,node_redis toneAmber
class node_orders,node_catalog,node_reviews toneMint
class node_identity,node_order_repository,node_product_repository,node_payment_service,node_database toneRose
class node_customer,node_stripe,node_signalr toneIndigo
```

## Components

### API entry points

- [Orders API](https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.WebAPI/Controllers/OrdersController.cs): `src/ECommerce.WebAPI/Controllers/OrdersController.cs`
- [Payments API](https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.WebAPI/Controllers/PaymentsController.cs): `src/ECommerce.WebAPI/Controllers/PaymentsController.cs`
- [Payment webhooks](https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.WebAPI/Controllers/WebhooksController.cs): `src/ECommerce.WebAPI/Controllers/WebhooksController.cs`

### Application workflows

- [Order commands](https://github.com/moaazalaa12/ecommerce-cleanarchitecture/tree/main/src/ECommerce.Application/Features/Orders/Commands): `src/ECommerce.Application/Features/Orders/Commands`
- [Order queries](https://github.com/moaazalaa12/ecommerce-cleanarchitecture/tree/main/src/ECommerce.Application/Features/Orders/Queries): `src/ECommerce.Application/Features/Orders/Queries`
- [Create order](https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Application/Features/Orders/Commands/CreateOrder/CreateOrderCommandHandler.cs): `src/ECommerce.Application/Features/Orders/Commands/CreateOrder/CreateOrderCommandHandler.cs`
- [Get order](https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Application/Features/Orders/Queries/GetOrderById/GetOrderByIdQueryHandler.cs): `src/ECommerce.Application/Features/Orders/Queries/GetOrderById/GetOrderByIdQueryHandler.cs`
- [List user orders](https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Application/Features/Orders/Queries/GetUserOrders/GetUserOrdersQueryHandler.cs): `src/ECommerce.Application/Features/Orders/Queries/GetUserOrders/GetUserOrdersQueryHandler.cs`
- [Payment commands](https://github.com/moaazalaa12/ecommerce-cleanarchitecture/tree/main/src/ECommerce.Application/Features/Payments/Commands): `src/ECommerce.Application/Features/Payments/Commands`
- [Create payment intent](https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Application/Features/Payments/Commands/CreatePaymentIntent/CreatePaymentIntentCommandHandler.cs): `src/ECommerce.Application/Features/Payments/Commands/CreatePaymentIntent/CreatePaymentIntentCommandHandler.cs`
- [Refund payment](https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Application/Features/Payments/Commands/RefundPayment/RefundPaymentCommandHandler.cs): `src/ECommerce.Application/Features/Payments/Commands/RefundPayment/RefundPaymentCommandHandler.cs`
- [Update payment status](https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Application/Features/Payments/Commands/UpdatePaymentStatus/UpdatePaymentStatusCommandHandler.cs): `src/ECommerce.Application/Features/Payments/Commands/UpdatePaymentStatus/UpdatePaymentStatusCommandHandler.cs`

### Commerce domain

- [Orders and payments](https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Domain/Entities/OrderEntities/Order.cs): `src/ECommerce.Domain/Entities/OrderEntities/Order.cs`
- [Product catalog](https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Domain/Entities/CatalogEntities/Product.cs): `src/ECommerce.Domain/Entities/CatalogEntities/Product.cs`
- [Product reviews](https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Domain/Entities/CatalogEntities/Review.cs): `src/ECommerce.Domain/Entities/CatalogEntities/Review.cs`

### Infrastructure

- [Identity service](https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Infrastructure/Identity/IdentityService.cs): `src/ECommerce.Infrastructure/Identity/IdentityService.cs`
- [Order repository](https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Infrastructure/Repositories/OrderRepository.cs): `src/ECommerce.Infrastructure/Repositories/OrderRepository.cs`
- [Product repository](https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Infrastructure/Repositories/ProductRepository.cs): `src/ECommerce.Infrastructure/Repositories/ProductRepository.cs`
- [Payment service](https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Infrastructure/ExternalServices/Payment/PaymentService.cs): `src/ECommerce.Infrastructure/ExternalServices/Payment/PaymentService.cs`
- [Application database](https://github.com/moaazalaa12/ecommerce-cleanarchitecture/blob/main/src/ECommerce.Infrastructure/Persistence/DbContext/ApplicationDbContext.cs): `src/ECommerce.Infrastructure/Persistence/DbContext/ApplicationDbContext.cs`

### Other components

- **Customer**
- **Stripe**
- **Redis caching**
- **SignalR notifications**

## Connections

- Customer → Orders API: requests (evidence: `src/ECommerce.WebAPI/Controllers/OrdersController.cs`)
- Customer → Payments API: requests (evidence: `src/ECommerce.WebAPI/Controllers/PaymentsController.cs`)
- Orders API → Order commands: dispatches (evidence: `src/ECommerce.WebAPI/Controllers/OrdersController.cs`)
- Orders API → Order queries: dispatches (evidence: `src/ECommerce.WebAPI/Controllers/OrdersController.cs`)
- Payments API → Payment commands: dispatches (evidence: `src/ECommerce.WebAPI/Controllers/PaymentsController.cs`)
- Payment webhooks → Update payment status: dispatches (evidence: `src/ECommerce.WebAPI/Controllers/WebhooksController.cs`)
- Order commands → Create order: handles (evidence: `src/ECommerce.Application/Features/Orders/Commands/CreateOrder/CreateOrderCommandHandler.cs`)
- Order queries → Get order: handles (evidence: `src/ECommerce.Application/Features/Orders/Queries/GetOrderById/GetOrderByIdQueryHandler.cs`)
- Order queries → List user orders: handles (evidence: `src/ECommerce.Application/Features/Orders/Queries/GetUserOrders/GetUserOrdersQueryHandler.cs`)
- Payment commands → Create payment intent: handles (evidence: `src/ECommerce.Application/Features/Payments/Commands/CreatePaymentIntent/CreatePaymentIntentCommandHandler.cs`)
- Payment commands → Refund payment: handles (evidence: `src/ECommerce.Application/Features/Payments/Commands/RefundPayment/RefundPaymentCommandHandler.cs`)
- Payment commands → Update payment status: handles (evidence: `src/ECommerce.Application/Features/Payments/Commands/UpdatePaymentStatus/UpdatePaymentStatusCommandHandler.cs`)
- Create order → Order repository: reads and writes (evidence: `src/ECommerce.Application/Features/Orders/Commands/CreateOrder/CreateOrderCommandHandler.cs`)
- Create order → Product repository: reads products (evidence: `src/ECommerce.Application/Features/Orders/Commands/CreateOrder/CreateOrderCommandHandler.cs`)
- Get order → Order repository: loads order (evidence: `src/ECommerce.Application/Features/Orders/Queries/GetOrderById/GetOrderByIdQueryHandler.cs`)
- List user orders → Order repository: loads page (evidence: `src/ECommerce.Application/Features/Orders/Queries/GetUserOrders/GetUserOrdersQueryHandler.cs`)
- Create payment intent → Order repository: loads order (evidence: `src/ECommerce.Application/Features/Payments/Commands/CreatePaymentIntent/CreatePaymentIntentCommandHandler.cs`)
- Create payment intent → Payment service: requests intent (evidence: `src/ECommerce.Application/Features/Payments/Commands/CreatePaymentIntent/CreatePaymentIntentCommandHandler.cs`)
- Order repository → Application database: queries (evidence: `src/ECommerce.Infrastructure/Repositories/OrderRepository.cs`)
- Product repository → Application database: queries
- Payment service → Stripe: integrates (evidence: `README.md`)
- Customer → Redis caching: uses caching (evidence: `README.md`)
- SignalR notifications → Customer: notifies (evidence: `README.md`)
