PROJECTS / 2026
Sales Project
A sales API in .NET with DDD, CQRS through MediatR and events published to RabbitMQ. Quantity discounts computed in the domain, soft deletes, and no business rules hiding in controllers.
OVERVIEW
A REST API for a sales system: users, products, branches, and sales with their items. The core rule lives in sales — the discount is computed automatically from the number of identical items, the total is recalculated on every change, and the price used is always the product's price at the moment of the sale.
CONCEPT
DDD with CQRS and events. The domain holds the entities and rules and depends on nothing; each use case is a command with its own handler, validator and mapping, dispatched by MediatR. Every meaningful change — sale created, modified, cancelled, items cancelled — becomes an event published to RabbitMQ through Rebus, so other systems can react without the API knowing who they are.
FEATURES
- CRUD for users, products, branches and sales
- Quantity discount: 10% for 4 to 9 items, 20% for 10 to 20, blocked above that
- Items removed in an update are cancelled, not deleted
- Soft delete and sale reactivation
- Pagination and filters by name, status and date range
- Domain events published to RabbitMQ
- Structured logging with Serilog and global exception handling
HOW IT WORKS
The solution is split into WebApi, Application, Domain, ORM, IoC and Common. A request reaches the WebApi, becomes a command validated with FluentValidation and goes to its handler in Application, which applies the Domain rules, persists through the repository into PostgreSQL with EF Core and publishes the event. Everything starts with Docker Compose: API, database and RabbitMQ.
STACK
- CSharp
- DotNet
- PostgreSQL
- RabbitMQ
- Docker