Event Sourcing

Marten

.NET Transactional Document DB and Event Store on PostgreSQL

Marten on GitHub 1
martendb.io documentation 2

Samples

FreightShipping sample 3
Marten tutorial: Building a Freight and Delivery System 4
AspNetCoreWithMarten sample 5
Helpdesk sample 6
EventSourcingTests.Aggregation — aggregate stream into samples 7
Core.Marten at oskardudycz EventSourcing.NetCore 8

Learning

Understanding Event Sourcing with Marten 9
Advanced considerations — Optimistic Concurrency and deployment 10
CQRS command handler workflow for capturing events 11
Integration testing with Marten 12
Unit testing Query<T> 13

Jargon

  • Stream aggregation process = state rehydration / state rebuild
  • critter = creature (informal name for the JasperFx library ecosystem)

The Critter Stack

The “Critter Stack” is the informal name for the set of JasperFx open-source .NET libraries (all with animal/creature names) commonly used together to build event-driven, CQRS systems:

Library Role
Marten PostgreSQL document DB + event store
Wolverine Lightweight messaging / command and event bus
Lamar Fast IoC/DI container
Oakton Command-line / host utilities (runtime diagnostics and CLI commands)
Alba Integration testing harness for ASP.NET Core
Weasel PostgreSQL schema management helpers (used internally by Marten)

Purpose: Provide an opinionated, cohesive toolkit for building transactional, event-sourced, messaging-centric .NET applications without heavy framework overhead.

Usage pattern: Marten for persistence and events, Wolverine for commands/events and retries, Lamar for DI, Oakton for operational tooling, Alba for high-fidelity tests, Weasel for schema evolution.

Event Sourcing with .NET

EventSourcing.NetCore — examples and tutorials of Event Sourcing in .NET 14
Real-World CQRS/ES with ASP.NET and Redis Part 1 — Overview 15

< «