How moaazalaa12/ecommerce-cleanarchitecture works
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: OrderRepository.cs Order repository · Commands Payment commands · OrdersController.cs Orders API · Queries Order queries
Components 24
API entry points
- Orders API
src/ECommerce.WebAPI/Controllers/OrdersController.cs - Payments API
src/ECommerce.WebAPI/Controllers/PaymentsController.cs - Payment webhooks
src/ECommerce.WebAPI/Controllers/WebhooksController.cs
Application workflows
- Order commands
src/ECommerce.Application/Features/Orders/Commands - Order queries
src/ECommerce.Application/Features/Orders/Queries - Create order
src/ECommerce.Application/Features/Orders/Commands/CreateOrder/CreateOrderCommandHandler.cs - Get order
src/ECommerce.Application/Features/Orders/Queries/GetOrderById/GetOrderByIdQueryHandler.cs - List user orders
src/ECommerce.Application/Features/Orders/Queries/GetUserOrders/GetUserOrdersQueryHandler.cs - Payment commands
src/ECommerce.Application/Features/Payments/Commands - Create payment intent
src/ECommerce.Application/Features/Payments/Commands/CreatePaymentIntent/CreatePaymentIntentCommandHandler.cs - Refund payment
src/ECommerce.Application/Features/Payments/Commands/RefundPayment/RefundPaymentCommandHandler.cs - Update payment status
src/ECommerce.Application/Features/Payments/Commands/UpdatePaymentStatus/UpdatePaymentStatusCommandHandler.cs
Commerce domain
- Orders and payments
src/ECommerce.Domain/Entities/OrderEntities/Order.cs - Product catalog
src/ECommerce.Domain/Entities/CatalogEntities/Product.cs - Product reviews
src/ECommerce.Domain/Entities/CatalogEntities/Review.cs
Infrastructure
- Identity service
src/ECommerce.Infrastructure/Identity/IdentityService.cs - Order repository
src/ECommerce.Infrastructure/Repositories/OrderRepository.cs - Product repository
src/ECommerce.Infrastructure/Repositories/ProductRepository.cs - Payment service
src/ECommerce.Infrastructure/ExternalServices/Payment/PaymentService.cs - Application database
src/ECommerce.Infrastructure/Persistence/DbContext/ApplicationDbContext.cs
Other components
- Customer
- Stripe
- Redis caching
- SignalR notifications
Connections 23
- Customer → Orders API: requests
src/ECommerce.WebAPI/Controllers/OrdersController.cs - Customer → Payments API: requests
src/ECommerce.WebAPI/Controllers/PaymentsController.cs - Orders API → Order commands: dispatches
src/ECommerce.WebAPI/Controllers/OrdersController.cs - Orders API → Order queries: dispatches
src/ECommerce.WebAPI/Controllers/OrdersController.cs - Payments API → Payment commands: dispatches
src/ECommerce.WebAPI/Controllers/PaymentsController.cs - Payment webhooks → Update payment status: dispatches
src/ECommerce.WebAPI/Controllers/WebhooksController.cs - Order commands → Create order: handles
src/ECommerce.Application/Features/Orders/Commands/CreateOrder/CreateOrderCommandHandler.cs - Order queries → Get order: handles
src/ECommerce.Application/Features/Orders/Queries/GetOrderById/GetOrderByIdQueryHandler.cs - Order queries → List user orders: handles
src/ECommerce.Application/Features/Orders/Queries/GetUserOrders/GetUserOrdersQueryHandler.cs - Payment commands → Create payment intent: handles
src/ECommerce.Application/Features/Payments/Commands/CreatePaymentIntent/CreatePaymentIntentCommandHandler.cs - Payment commands → Refund payment: handles
src/ECommerce.Application/Features/Payments/Commands/RefundPayment/RefundPaymentCommandHandler.cs - Payment commands → Update payment status: handles
src/ECommerce.Application/Features/Payments/Commands/UpdatePaymentStatus/UpdatePaymentStatusCommandHandler.cs - Create order → Order repository: reads and writes
src/ECommerce.Application/Features/Orders/Commands/CreateOrder/CreateOrderCommandHandler.cs - Create order → Product repository: reads products
src/ECommerce.Application/Features/Orders/Commands/CreateOrder/CreateOrderCommandHandler.cs - Get order → Order repository: loads order
src/ECommerce.Application/Features/Orders/Queries/GetOrderById/GetOrderByIdQueryHandler.cs - List user orders → Order repository: loads page
src/ECommerce.Application/Features/Orders/Queries/GetUserOrders/GetUserOrdersQueryHandler.cs - Create payment intent → Order repository: loads order
src/ECommerce.Application/Features/Payments/Commands/CreatePaymentIntent/CreatePaymentIntentCommandHandler.cs - Create payment intent → Payment service: requests intent
src/ECommerce.Application/Features/Payments/Commands/CreatePaymentIntent/CreatePaymentIntentCommandHandler.cs - Order repository → Application database: queries
src/ECommerce.Infrastructure/Repositories/OrderRepository.cs - Product repository → Application database: queries
- Payment service → Stripe: integrates
README.md - Customer → Redis caching: uses caching
README.md - SignalR notifications → Customer: notifies
README.md