How muhametaydn/ecommerceapi-cleanarchitecture works
This is a .NET e-commerce REST API. A client request enters an API controller, is handled through CQRS application features, and reaches domain behavior and persistence or supporting services; order and stock changes can also raise domain events for outbox-backed messaging. The graph preserves the documented catalog, cart, checkout, identity, and merchandising capabilities. Several feature implementations and runtime registrations were not sampled, so their internal links are omitted; documented but unverified integrations are dashed.
Main entry points: Features CQRS handlers · Controllers REST controllers · ElasticsearchService.cs Elasticsearch search · DomainEventDispatcher.cs Domain event dispatch
Components 23
API entry
- REST controllers
src/ECommerce.API/Controllers - API middleware
src/ECommerce.API/Middlewares
Commerce features
- Identity and tokens
src/ECommerce.Infrastructure/Services/AuthService.cs - Products and search
src/ECommerce.Application/Features/Products - Category management
src/ECommerce.Application/Features/Categories - Shopping cart
src/ECommerce.Application/Features/Cart - Orders and checkout
src/ECommerce.Application/Features/Orders - Payments
src/ECommerce.Application/Features/Payments - Coupons
src/ECommerce.Application/Features/Coupons - Product reviews
src/ECommerce.Application/Features/Reviews - Customer addresses
src/ECommerce.Application/Features/Addresses
Domain and application
- CQRS handlers
src/ECommerce.Application/Features - Validation and cache behaviors
src/ECommerce.Application/Common/Behaviors - Commerce domain
src/ECommerce.Domain/Entities
Infrastructure and data
- Domain event dispatch
src/ECommerce.Infrastructure/Events/DomainEventDispatcher.cs - Outbox processor
src/ECommerce.Infrastructure/Jobs/OutboxProcessorJob.cs - PostgreSQL data
src/ECommerce.Persistence/Context/ApplicationDbContext.cs - Redis cache and cart
src/ECommerce.Infrastructure/Services/RedisCacheService.cs - Elasticsearch search
src/ECommerce.Infrastructure/Services/ElasticsearchService.cs - RabbitMQ event bus
src/ECommerce.Infrastructure/EventBus/MassTransitEventBus.cs - Email service
src/ECommerce.Infrastructure/Services/EmailService.cs
Other components
- Client
- Elasticsearch index
Connections 17
- Client → REST controllers: sends requests
- REST controllers → API middleware: passes through
- REST controllers → CQRS handlers: dispatches requests
src/ECommerce.API/Controllers/ReviewsController.cs - REST controllers → Orders and checkout: dispatches commands
src/ECommerce.API/Controllers/OrdersController.cs - REST controllers → Product reviews: dispatches requests
src/ECommerce.API/Controllers/ReviewsController.cs - CQRS handlers → Validation and cache behaviors: runs through
- CQRS handlers → Identity and tokens: uses identity
src/ECommerce.Infrastructure/Services/AuthService.cs - CQRS handlers → Redis cache and cart: caches responses
- CQRS handlers → Elasticsearch search: queries search
src/ECommerce.Application/Features/Products/Queries/SearchProducts/SearchProductsQueryHandler.cs - CQRS handlers → PostgreSQL data: uses repositories
- CQRS handlers → Commerce domain: applies domain behavior
src/ECommerce.Domain/Entities/Order.cs - PostgreSQL data → Domain event dispatch: dispatches domain events
src/ECommerce.Persistence/Context/ApplicationDbContext.cs - Domain event dispatch → Outbox processor: persists messages
- Outbox processor → RabbitMQ event bus: publishes events
- RabbitMQ event bus → Email service: triggers notifications
- Elasticsearch search → Elasticsearch index: searches index
- Products and search → Elasticsearch search: requests product search
src/ECommerce.Application/Features/Products/Queries/SearchProducts/SearchProductsQueryHandler.cs