This is the repo for the backend component of the SensrNet application. It features a NodeJS backend, makes use of Eventstore for event sourcing, and MongoDB for storing the projection.
The stack can be ran either locally, using docker with docker-compose, or deployed on a kubernetes cluster.
In order to run this application standalone, you need npm, Eventstore and MongoDB installed.
In order to run this application containerized, you'll need docker installed.
The architecture is an event-sourced one. Simplified it looks like this:
The (almost) complete structure looks like this:
- auth: Module to handle authentication and creating users in the database (from external identity providers)
- command: the 'command side' of the system processing requested changes; this is the most complex part with:
- controllers: the API
- command handlers: handling commands
- repositories: loading aggregates from events
- aggregates: validation and producing events
- query processors and service needed for validation
- query:
- Query processor to update the MongoDB projection
- Query controllers and features
- commons: module containing shared parts like:
- events: the 'core API' of the system
- event-store: interface to the EventStoreDB
- models: shared data models (e.g. User)
- health: Functionality to determine the application health
The runtime is defined by multiple Docker containers / Dockerfile
s. In case of scaling up or out, the query processor
should be put in its own container (probably stays as a single container).
Eventstore:
- Should be running. For instructions, view the Eventstore Documentation.
MongoDB:
- Should be running. For instructions, view the MongoDB Documentation.
Or by using the convenient separate docker compose file:
$ docker-compose -f docker-compose.dev.yml up
Backend App:
$ npm ci
$ npm start
Start entire stack:
$ docker-compose up --build
Stop entire stack:
$ docker-compose stop
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
Should you have any questions or concerns, please reach out to one of the project's Maintainers.
This work is licensed under a EUPL v1.2 license.