A modern e-commerce platform built using microservices architecture with .NET 8, implementing best practices for cloud-native applications.
This project follows a microservices architecture with the following key principles:
- CQRS (Command Query Responsibility Segregation) - Separation of read and write operations
- Vertical Slice Architecture - Feature-based organization instead of technical layers
- Clean Architecture - Clear separation of concerns and dependencies
- Docker Support - Containerization for easy deployment and scalability
EShopMicroservices/ βββ src/ β βββ BuildingBlocks/ # Shared libraries and common components β β βββ BuildingBlocks/ β β βββ CQRS/ # CQRS abstractions (Comma``nds, Queries, Handlers) β β βββ ICommand.cs β β βββ ICommandHandler.cs β β βββ IQuery.cs β β βββ IQueryHandler.cs β βββ Services/ # Microservices β β βββ Catalog/ # Product catalog service β β βββ Catalog.API/ β β βββ Models/ # Domain models β β β βββ Product.cs β β βββ Products/ # Product features (vertical slices) β β β βββ CreateProduct/ β β β βββ CreateProductEndpoint.cs β β β βββ CreateProductHandler.cs β β βββ Properties/ β β β βββ launchSettings.json β β βββ Dockerfile β β βββ GlobalUsing.cs β β βββ Program.cs β β βββ appsettings.json β β βββ appsettings.Development.json β βββ .dockerignore β βββ eshop-microservices.sln βββ .gitignore βββ LICENSE βββ README.md
- .NET 8 - Latest .NET framework
- C# 12 - Modern C# features
- Carter - Minimal API organization and routing
- MediatR - Mediator pattern implementation for CQRS
- Mapster - High-performance object mapping
- Docker - Containerization
Manages product catalog operations including creating, reading, updating, and deleting products.
Features:
- β Create Product
Planned Features:
- β³ Get Products
- β³ Get Product by ID
- β³ Update Product
- β³ Delete Product
The BuildingBlocks project contains shared infrastructure and abstractions used across all microservices:
- ICommand / ICommand<TResponse> - Command abstractions for write operations
- IQuery<TResponse> - Query abstractions for read operations
- ICommandHandler - Command handler contracts
- IQueryHandler - Query handler contracts
These interfaces integrate seamlessly with MediatR to provide a consistent CQRS implementation across all services.
- .NET 8 SDK
- Docker (optional, for containerized deployment)
- Visual Studio 2022 or VS Code
- Clone the repository
- Restore dependencies -
dotnet restore - Run the application -
dotnet run - Using Docker - docker build -t catalog-api -f Services/Catalog/Catalog.API/Dockerfile . docker run -p 8080:8080 catalog-api
Endpoint: POST /products
Status Code: 201 Created
Request Body:
{
"Name": "New Product A",
"Category": ["c1", "c2"],
"Description": "Description Product A",
"ImageFile": "ImageFile Product A",
"Price": 199
}Response:
{
"id": "d6ac5f15-dda8-452d-82e6-ef5aee1c3bef"
}