cqrs-python-demo
cqrs-python-demo copied to clipboard
For research purposes only. Learn from our experiments :)
WIP
cqrs-python-demo
For research purposes only. But feel free to learn from our experiments :)
Generally this is an attempt to do the following:
- working CQRS system
- event sourced
- view model
- commands
- single REST api (for convenience)
Built with 🍁 by fellows of ferstdigital.com
The Stack
Since we're considering event-sourcing and CQRS for our own techstack, I wanted to try it out first hand, using some pre-made event-source offering. The focus was to get a practical feel of a CQRS implementation, and the possible issues with event-sourcing.
- Event Sourcing https://geteventstore.com
- Event Store Client https://github.com/madedotcom/atomicpuppy
- REST API http://flask.pocoo.org
- View Models https://www.postgresql.org
Other event-sourcing considerations
- C#, .NET, and plenty of community adapters https://geteventstore.com
- Java http://eventuate.io
- Python https://github.com/johnbywater/eventsourcing
- Database Log Tailing http://debezium.io
Install
copy docker.env to .env
Easiest way to get this up and running is to use docker-compose.
2. For docker-compose:
docker-compose up -d --build
2. Locally
copy docker.env to .env
setup python
virtualenv env
. env/bin/activate
pip install -r requirements.txt
start the view model sync
python apps/readaccount/app.py
start the REST api
gunicorn apps.restaccount.app
Development
docker-compose up -d postgres
docker-compose up -d eventstore
see docker-compose.yml for exposed ports, passwords, et al.
What is CQRS?
CQRS stands for Command Query Responsibility Segregation
https://martinfowler.com/bliki/CQRS.html
Learn more about CQRS
If you're new to microservices or command query responsibility segregation checkout some of these resources which I found particularily useful.