{"id":20127262,"url":"https://github.com/code2k13/cqrs-example","last_synced_at":"2026-03-19T14:02:33.765Z","repository":{"id":179784087,"uuid":"515207354","full_name":"code2k13/cqrs-example","owner":"code2k13","description":"An opiniated sample implementation of CQRS architectural pattern on Kubernetes using NodeJS, Redis and Helm","archived":false,"fork":false,"pushed_at":"2022-07-18T14:58:08.000Z","size":639,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-25T09:33:34.308Z","etag":null,"topics":["architectural-patterns","architecture","cqrs-application","cqrs-pattern","design-patterns"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/code2k13.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-07-18T13:59:13.000Z","updated_at":"2022-07-18T15:13:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"7e4a4056-e6c5-4e11-a24a-c2dd334f424a","html_url":"https://github.com/code2k13/cqrs-example","commit_stats":null,"previous_names":["code2k13/cqrs-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/code2k13/cqrs-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code2k13%2Fcqrs-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code2k13%2Fcqrs-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code2k13%2Fcqrs-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code2k13%2Fcqrs-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/code2k13","download_url":"https://codeload.github.com/code2k13/cqrs-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code2k13%2Fcqrs-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29704810,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T03:17:42.375Z","status":"ssl_error","status_checked_at":"2026-02-22T03:17:31.622Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["architectural-patterns","architecture","cqrs-application","cqrs-pattern","design-patterns"],"created_at":"2024-11-13T20:20:00.554Z","updated_at":"2026-02-22T04:33:35.707Z","avatar_url":"https://github.com/code2k13.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CQRS architectural pattern sample implementation\nAn opinionated sample implementation of [CQRS (Command Query Responsibility Segregation)](https://docs.microsoft.com/en-us/azure/architecture/patterns/cqrs) architectural pattern on Kubernetes using NodeJS, Redis and Helm. This is only for learning and tinkering around and **SHOULD NOT BE USED in production**. It has basically three components:\n\n* A web app written in NodeJS (which can be thought of a microservice)\n* A 'write' datastore (implemented using Redis master instance)\n* A 'read' datastore (implemented using Redis replica instances )\n\n![diagram of the components](cqrs_pattern_diagram.png)\n\n\n## Installing\n\nYou will need to have working Kubernetes cluster (real, K3S, minikube, microk8s anything will do !) and [helm](https://helm.sh/).\n\nNeed to add the Bitnami repo to Helm\n\n```bash\nhelm repo add bitnami https://charts.bitnami.com/bitnami\n```\n\nThen, we install redis in master-replica configuration using [Bitnami's Redis Helm chart](https://bitnami.com/stack/redis/helm)\n\n```bash\nhelm install  cqrs-redis bitnami/redis --set replica.replicaCount=1 --set master.count=1\n```\n\nThen we deploy the web app  using [it's docker image](https://hub.docker.com/repository/docker/code2k13/cqrs-frontend) via the deploy.yaml file.\n\n\u003e You may choose to build your own docker image using the Dockerfile in this repository if you don't want to use third party images.\n\n```bash\nkubectl apply -f deploy.yaml\n```\n\nYou should see three pods running after the above steps, something like this\n\n```bash\nNAME                    READY   STATUS    RESTARTS       AGE\ncqrs-frontend           1/1     Running   2 (30m ago)    18h\ncqrs-redis-master-0     1/1     Running   2 (30m ago)    18h\ncqrs-redis-replicas-0   1/1     Running   43 (65s ago)   18h\n```\n\n## Using the application\n\nTo open the application in webbrowser, you will have to proxy port 8080 of cqrs-frontend to some port on your computer\n\n```bash\nkubectl port-forward cqrs-frontend 9001:8080\n```\nVisiting the port 9001 for example, should show a GUI that looks like this.\n\n![Application's user interface](cqrs_gui.png)\n\nThe left section is for writes, clicking on 'Save' will write data to '*cqrs-redis-master-0*'. The right section is for reads, clicking on 'Search' will query '*cqrs-redis-replica-0*'. Redis internally syncs master and replicas. We could scale number of replicas if we wanted to, one of the benefits of the pattern. If the replica goes down, master is still functional and no data is lost.\n\n## Cleanup\n\n\n```bash\nhelm delete cqrs-redis\n```\n\n```bash\nkubectl delete -f deploy.yaml\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode2k13%2Fcqrs-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcode2k13%2Fcqrs-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode2k13%2Fcqrs-example/lists"}