Blog

Domain-Driven Design and Command-Query Separation example application

Erik Rozendaal

Updated April 29, 2025
2 minutes

Ever since attending Greg Young's Unshackle Your Domain talk at QCon '08 in San Francisco and a later two-day training course given by Greg Young I've wanted to build a sample application that made use of the principles of Command-Query Responsibility Separation (CQRS). However, other interesting things intervened and I never got around to doing this. But every few months we have a one day internal training course at Xebia Software Development and after Sjors Grijpink and I proposed to give a training on DDD and CQRS we got some time to actually prepare and implement a CQRS example application.

The Xebia Lottery The application is fairly simple (as it should be for a one day training course) but touches on all the major components needed for a full-blown CQRS implementation. CQRS components The source code for the training exercises can be found at github. There are three branches:

  1. exercise - the code used for doing the training exercises.
  2. solution - the same code as above but with the solutions added.
  3. master - the main development branch, currently used to implement more advanced features like snapshotters, command-event conflict resolution, historical tracing, etc.

The Xebia ITR CQRS presentation is also available. All-in-all the training was a success and I think that the basic CQRS principles are the way forward when you need to build enterprise applications with a complicated domain logic or strong auditing or historical tracing requirements.

Written by

Erik Rozendaal

Our Ideas

Explore More Blogs

View All

Prashant Rao


Content Test

Content Test

Prashant Rao


test new 9

test new 9

Puneet Pathak


co author test

co author test

Puneet Pathak, Adam23172 Rzymowski23172, Anna Małek, Deepanshu Garg, Heeren Tanna

Contact

Let’s discuss how we can support your journey.