Sample implementation of CQRS architectural pattern

Block diagram onf the sample implementation.

I was recently rereading some software architecture literature. One of the frequent patterns whose names appear in the majority of publications on architectural design patterns is the CQRS pattern. The majority of these sources contain source code and information about this pattern. I therefore made the decision to produce a working prototype. The CQRS (Command Query Responsibility Segregation) architectural pattern is implemented in this opinionated sample implementation on Kubernetes utilising NodeJS, Redis, and Helm. This should not be used in production and is solely intended for learning and experimenting. Basically, it consists of three parts:

  • A web app written in NodeJS (which can be thought of a microservice)
  • A ‘write’ datastore (implemented using Redis master instance)
  • A ‘read’ datastore (implemented using Redis replica instances)

The goal was to develop a simple sandbox implementation that is as beneficial for learners and hobbyists and is as realistic as possible. To give you a sense of how the example would work in the real world, I used Kubernetes and Helm for the implementation.