Reference implementation of the Event Sourcing pattern in .NET — a standalone study project built to internalize distributed-systems design end-to-end, beyond what tutorials typically cover.
Event Sourcing persists the application's state as a sequence of immutable events rather than the current state. To reconstruct any entity, you replay its event stream from the beginning. This gives you:
- Complete audit trail by design (every change is a recorded event)
- Time-travel debugging — rewind to any past state
- Projection flexibility — derive multiple read models from the same event stream
- Natural fit with CQRS — commands write events, queries read projections
This project implements a Product aggregate whose state is rebuilt by replaying events from a custom Event Store service.
┌────────────────────┐
│ Product.Application│ POST /products → emit ProductCreated event
└────────────────────┘ │
│ ▼
│ ┌──────────────┐
│ query (replay events) │ Event.Store │
├───────────────────────────────▶│ (append-only│
│ │ log) │
▼ └──────────────┘
┌────────────────────────────┐ │
│ Product.Event.Handler │ ◀────── subscribes ───┘
│ .Service │
│ (builds projections) │
└────────────────────────────┘
| Layer | Technology |
|---|---|
| Runtime | .NET / ASP.NET Core |
| Event Store | Custom append-only log service |
| Projections | Background event-handler service |
| Pattern | Event Sourcing |
.
├── Event.Store/ # The append-only event store service
├── Product.Application/ # Command side — emits events
├── Product.Event.Handler.Service/ # Builds projections by replaying events
├── Shared/ # Event contracts and base types
└── Microservices.Event.Store.sln
- CQRS — Commands emit events; queries read projections.
- Outbox / Inbox — Reliable event propagation across services.
Built by Ali Kalantari — a Backend Developer specialising in regulated fintech systems (.NET, Python, multi-database, event-driven).
This repository is part of my Distributed Systems Reference Series: a set of standalone study projects, each focused on one pattern, that I keep as working references when implementing similar designs in production.
Browse the full series: github.com/Ali-Klnai?tab=repositories&q=Microservices.