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"
}