Coder Social home page Coder Social logo

cqrs-example-service's Introduction

CQRS Example

This project is an example of how to apply a CQRS pattern for a microservice project. It utilises event sourcing as a single source of immutable truth for its ecosystem, processing commands and transactions to the hub, subscribing to the event stream, aggregating them and then allow them to be queried.

At first glance this project may look like overkill for a pretty simple CRUD service, but out of the box you get a lot of extensible functionality.

  • A single source of truth
  • Prevention of race conditions
  • Audit logging
  • The ability to add new views to manipulate the data in any peceived way without effecting the underlying system, using any type of technology

Running

The system uses mongodb and a docker image for the event-hub daviddyke/cqrs-event-hub, as well as a generic api gateway for accessing turbosonic/api-gateway the rest of the code can be run from the docker-compose file.

$ docker-compose up

NONE OF THIS PROJECT IS PRODUCTION READY CODE (yet)

cqrs-example-service's People

Watchers

 avatar

cqrs-example-service's Issues

performTransaction can accept a non-integer amount

It's possible to submit transaction.amount as a string, which will break the balance returned.

Example:

PUT /accounts/id

{
	"description": "deposit a milli",
	"amount": "1000000"
}
...
{
	"description": "buy a flat",
	"amount": -380000
}

Would result in:

GET /accounts/id

{
	...,
	"balance": "1000000-380000",
	...
}

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.