Skip to content

Repository files navigation

Microservices · Event Store (Event Sourcing)

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.

What This Project Demonstrates

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.

Architecture

  ┌────────────────────┐
  │ Product.Application│   POST /products  →  emit ProductCreated event
  └────────────────────┘                              │
              │                                       ▼
              │                                ┌──────────────┐
              │  query (replay events)         │ Event.Store  │
              ├───────────────────────────────▶│  (append-only│
              │                                │   log)       │
              ▼                                └──────────────┘
  ┌────────────────────────────┐                       │
  │ Product.Event.Handler      │ ◀────── subscribes ───┘
  │  .Service                  │
  │  (builds projections)      │
  └────────────────────────────┘

Tech Stack

Layer Technology
Runtime .NET / ASP.NET Core
Event Store Custom append-only log service
Projections Background event-handler service
Pattern Event Sourcing

Project Structure

.
├── 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

Pairs Well With

  • CQRS — Commands emit events; queries read projections.
  • Outbox / Inbox — Reliable event propagation across services.

About

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.

About

Event Sourcing pattern in .NET with a custom event-store service — append-only event log + projections + replay support.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages