Event-sourced expenses backend with DDD, CQRS, and MassTransit.
- KurrentDB — event store (source of truth)
- PostgreSQL — config/reference data + read model projections
- RabbitMQ/MassTransit — async command transport and committed-event distribution
| Service | Description | Port |
|---|---|---|
WebApi |
REST API — publishes commands, queries projections | 5200 |
Worker.Domain |
Consumes commands, executes domain logic, appends events, forwards committed KurrentDB events to RabbitMQ | — |
Worker.Projections |
Consumes RabbitMQ committed events and builds read models in Postgres | — |
| Library | Responsibility |
|---|---|
Contracts |
Shared commands, integration events, models (NuGet package) |
Core.Domain |
Aggregates, domain events, value objects (zero dependencies) |
Core.Application |
Command handlers, repository abstractions |
Core.Infrastructure |
KurrentDB, Postgres, MassTransit implementations |
Projections |
Read models, projectors, query handlers |
WebApipublishes commands to RabbitMQ.Worker.Domainconsumes commands and appends domain events to KurrentDB.Worker.Domainforwarder reads committed events from a Kurrent persistent subscription and republishes them to RabbitMQ. The subscription group is configured for a single active subscriber usingDispatchToSingle.Worker.Projectionsconsumes committed events from RabbitMQ and updates Postgres read models.WebApireads projections from Postgres.
# Build
dotnet build WiSave.Expenses.slnx
# Run tests
dotnet test WiSave.Expenses.slnx
# Run with Docker
docker compose up --build| Service | Port |
|---|---|
| Expenses WebApi | 5200 |
| KurrentDB UI | 2113 |
| PostgreSQL | 5433 |
RabbitMQ is hosted by Portal (localhost:5672).
WiSave.Expenses.Contracts uses Nerdbank.GitVersioning for package versions.
- Pull requests targeting
masterpublish preview packages to GitHub Packages. - Pushes to
masterpublish stable packages to the same feed. - The package version is not hardcoded in the contracts
.csproj; it is derived from git history andversion.json.
The current contracts version line starts at 1.0.