Building Microservices: Using Node.js with DDD, CQRS, and Event Sourcing — Part 1 of 2

Qasim Soomro
14 min readMar 24, 2019

tl;dr: I aim to help you learn and apply CQRS and event sourcing using a modern approach.

Companies often have a desire to scale software from the very beginning. In this article, we will discuss an approach to building large-scale distributed microservice-based architectures using DDD, CQRS, and event sourcing.

The event sourcing pattern implies that events are the source of truth. CQRS and event sourcing based systems are often considered as building blocks for microservice architectures. Important questions can come up when CQRS and event sourcing is introduced — things like what events are required to carry out a given domain responsibility? or do we even need events or event sourcing? Thus, CQRS adds complexity and is not suitable for most projects.

I plan to share with you a modern approach for applying the CQRS and event sourcing patterns — using Node.js and TypeScript. Please note that both the CQRS and event sourcing patterns can be applied independently of one another. For my example project, I used an event store called “Event Store” designed by Greg Young (the guy who coined the term “CQRS”). Event Store makes the persistence and streaming of events, atomic — an atomic transaction implies a series of operations that occur either…

--

--