EventSourcingDB, CQRS and DDD¶
This guide explores how EventSourcingDB relates to the concepts of Command Query Responsibility Segregation (CQRS) and Domain-Driven Design (DDD). It explains how these ideas connect at a conceptual level and how they can be combined or used independently. EventSourcingDB itself does not require or enforce any particular architectural style, but it aligns well with many of the goals behind CQRS and DDD.
Understanding the relationship between these concepts helps developers and architects make informed decisions when designing systems that are event-sourced, message-driven, or domain-oriented.
Event Sourcing as the Foundation¶
At its core, EventSourcingDB is a database for storing immutable domain events. Each event represents something that has happened in the past and is associated with a subject that identifies the stream to which it belongs. The database guarantees ordering, atomicity, and consistency for these events and provides APIs for writing, reading, and observing them.
This event-centric approach is compatible with many architectural styles. While it naturally complements CQRS and DDD, it does not depend on them. Event sourcing can be used in simple applications or complex domains, with or without aggregates, commands, or bounded contexts.
EventSourcingDB deliberately avoids introducing high-level abstractions beyond events and streams. This makes it flexible and broadly applicable, even outside the contexts traditionally associated with CQRS or DDD.
CQRS: Separation of Commands and Queries¶
CQRS refers to the idea of separating commands (which change state) from queries (which read state). In many systems, this distinction helps clarify responsibilities, improve scalability, and support different models for writing and reading data.
In an event-sourced system, CQRS often emerges naturally:
- Commands are handled by application code, which decides what should happen and emits events.
- Events are stored as facts in the event store (such as EventSourcingDB).
- Read models are built by projecting events into structures optimized for querying.
EventSourcingDB supports this separation by design. It stores only the events — not the commands or read models. Application code is responsible for interpreting the events and updating any external read models as needed. This aligns with the principles of CQRS without requiring any particular implementation strategy.
Teams using CQRS can use EventSourcingDB as the write model (source of truth), and maintain separate read models in databases, caches, or search indexes. Those not using CQRS can still benefit from the durability, observability, and auditability that event sourcing provides.
DDD: Modeling the Domain with Intent¶
Domain-Driven Design encourages teams to model software based on the language, rules, and behavior of the business domain. It emphasizes concepts such as aggregates, entities, value objects, and bounded contexts, as well as collaboration between technical and domain experts.
While event sourcing and DDD are often used together, they are independent. It is possible to apply DDD principles using traditional persistence, and it is equally possible to build an event-sourced system without adopting DDD vocabulary or methodology.
EventSourcingDB does not require any DDD constructs. It has no opinion about aggregates, bounded contexts, or ubiquitous language. However, it does support many of the goals DDD promotes:
- Events capture meaningful domain facts
- Streams reflect the history of domain entities
- Event types and subjects provide stable identities and language
- Replay and projection enable model evolution over time
If you are using DDD, EventSourcingDB integrates naturally. If not, it remains a general-purpose event store that can be used in any system where events matter.
Flexibility by Design¶
The role of EventSourcingDB is to provide a reliable, consistent, and well-structured foundation for storing and retrieving events. How those events are produced, interpreted, and used is left to the application.
This design keeps EventSourcingDB unopinionated and interoperable. Whether you follow CQRS, DDD, both, or neither, you can use EventSourcingDB effectively. It enables rich domain modeling, but does not prescribe it.
By keeping the concepts of event sourcing separate from those of CQRS and DDD, EventSourcingDB gives teams the freedom to choose the architecture that fits their needs — while still benefiting from strong guarantees and a durable event log.