Giter VIP home page Giter VIP logo

django-cqrs's Introduction

django-cqrs

A demo application to show how cqrs can be implemented in Django

Bring up the services.

cd into the project root. (After cloning this repo)

Bring up the services up.

docker-compose up -d --build

Visit http://localhost:8000/posts/

Shutdown the containers.

docker-compose down

NOTE: For docker commands refer this

Test events replay

docker exec -it cqrs_web_1 blog/demo/replay_three.sh

docker exec -it cqrs_web_1 blog/demo/replay_all.sh

Architecture

Currently there are only two events PostCreatedEvent and PostUpdatedEvent.

I tried to replicate the concepts from this video I did not implement the command part.

There are 2 types of data,

  1. event data
  2. entity data

Event data captures every change to the system, whereas entity data has only the recent state.

Any state change to the application is captured through an event (PostCreatedEvent, PostUpdatedEvent). For storing event data I've used MongoDB and for storing entity data PostgresDB.

Creation of event data is handled in django forms. Forms save method is overloaded with the code which creates the events and makes a call to event handler. Event handler creates the application state, which in turn gets stored in postgres.

So all the writes go through Events and EventHandler and reads happen on the entity data which is stored in postgres.

If anybody wants to help out or interested about this, please open a PR or start a discussion in the issues section.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.