Fundamentals

Spring DDD is a lightweight library for Spring Boot applications that provides full Event Sourcing infrastructure and a standalone CQRS stack, built on Spring Data and jMolecules. Use either pillar independently or combine them to build event-driven applications without framework lock-in.

What Spring DDD provides

Spring DDD is organised around four independent, composable pillars:

Event Sourcing

Aggregate persistence via an append-only event log with snapshots, upcasting, and multi-dialect JDBC storage.

CQRS

Command and query buses with type-safe dispatch, projections that run in-memory by default — no database required — with optional durable JSON-over-JDBC or JPA storage, and derived query support.

Domain Events

Framework-managed @DomainEventHandler methods with after-commit dispatch, interception, and optional durable delivery via Spring Modulith.

SAGAs

Process managers for long-running workflows coordinated across aggregate boundaries, with ordered, at-least-once inbound delivery from the event store.

Each pillar has its own starter; the full-stack starters (spring-ddd-starter-jdbc, spring-ddd-starter-jpa) wire all four with a single dependency.

Example domain

All examples throughout this documentation use a banking domain: BankAccount aggregate identified by AccountId, value object Money, events AccountOpened / MoneyDeposited / MoneyWithdrawn, commands OpenAccount / DepositMoney / WithdrawMoney, and read model AccountSummary updated by AccountSummaryProjection.

Where to go next

To add Spring DDD to a project, see Installation and Quick start.

For the annotation vocabulary that underlies every pillar, continue with Building blocks & stereotypes.