ExpenseSplitter is a Domain-Driven Design (DDD) implemented API, meticulously crafted in C#. This project serves as a vivid showcase of how Clean Architecture priciples can be applied, with an emphasis on creating a robust and scalable solution for managing expenses among users. The API allows users to create settlements, add participants, and manage expenses with flexible splitting options, ensuring a comprehensive expense settlement system.
- Bold split into: Domain, Application, Infrastructure, and Presentation layers
- Domain layer: Entities, ValueObjects, DomainEvents, Domain Servies, Strongly typed IDs
- Application Layer: CQRS using MediatR with ICommand, IQuery, ICommandHandler, IQueryHandler abstractions, Logging for ICommandHandler, Validators with handling middleware, Result-driven communication, Idempotent/duplicated request handling, Railway-oriented programming (showcase)
- Presentation Layer: Minimal API with Swagger documentation, Trace ID middleware, Rate limiting.
- Infrastructure Layer: EF Core (DbContext, Entity mapping, DB migrations, Repositories), Authentication & Authorization, Database migrations
- Testing: Automated testing in CI, code coverage collection and history comparison, Architecture tests, testcontainers integration testing
- CI/CD: Dependabot integration, auto weekly nuget packages updates, Trivy scanning, SonarQube static-code analysis, automatic semantic-release, docker image publishing
- Docker support with docker-compose orchestration
To let you quickly understand the domain and relationships of the project entities I decided to create a class diagram.
Method | Path | Notes |
---|---|---|
π© POST | /users/login | |
π© POST | /users/register | |
π¦ GET | /users/me | |
π© POST | /settlements | Generates invite code |
π¦ GET | /settlements | |
π¦ GET | /settlements/{settlementId} | |
π¨ PUT | /settlements/{settlementId} | |
π₯ DELETE | /settlements/{settlementId} | |
π¦ GET | /settlements/{settlementId}/expenses | |
π¨ PUT | /settlements/join | Join using invite code |
π¨ PUT | /settlements/{settlementId}/leave | |
π¦ GET | /settlements/{settlementId}/reimbrusement | Balances and suggested reimbrusements |
πͺ PATCH | /settlements/{settlementId}/participants/{participantId}/claim | |
π© POST | /expenses | |
π¦ GET | /expenses/{expenseId} | |
π¨ PUT | /expenses/{expenseId} | |
π₯ DELETE | /expenses/{expenseId} |
- Add websockets for real time updates
- Currency support
- Outbox pattern
- Model diagram
docker-compose up -d expensesplitter-db expensesplitter-idp
dotnet ef migrations add --startup-project src/ExpenseSplitter.Api.Presentation --project src/ExpenseSplitter.Api.Infrastructure ...