Technology RadarTechnology Radar

CQRS/ES

Adopt

CQRS (Command Query Responsibility Segregation) is a pattern that separates the responsibility for handling read and write operations into separate components.

Event sourcing is a software development pattern that stores and reconstructs an application's state by capturing and replaying a sequence of events.

Read these articles from Martin Fowler about CQRS and event sourcing to understand why these ideas make sense:

Even if the two patterns work well together, they can also be used separately. So, evaluate the need for the patterns independently.

These technologies (like many others) comes with trade-offs:

It adds complexity to the system, so don't use it for trivial implementations that are not supposed to grow in complexity over time.

It’s not as straightforward as a simple CRUD implementation. It requires knowledge sharing within the team and people committed to the idea.

Re-creation of read models when millions of events are involved could become a bottleneck in the system. Especially if read models are the engine of a live view that needs to guarantee close to zero downtime. Think about this when you are designing your system.

Libraries

In Prima, we have a shared rust library for implementing the event sourcing pattern in an opinionated way, while in the elixir community Commanded is the de facto standard.