Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

kadaster-labs/sensrnet-registry-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SensRNet Backend Application

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.

Getting Started

The stack can be ran either locally, using docker with docker-compose, or deployed on a kubernetes cluster.

Prerequisities

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.

Architecture

The architecture is an event-sourced one. Simplified it looks like this:

Dependency Graph Simplified

The (almost) complete structure looks like this:

Dependency Graph

Modules:

  • 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 / Dockerfiles. In case of scaling up or out, the query processor should be put in its own container (probably stays as a single container).

Usage

Standalone

Eventstore:

MongoDB:

Or by using the convenient separate docker compose file:

$ docker-compose -f docker-compose.dev.yml up

Backend App:

$ npm ci

$ npm start

Containerized

Start entire stack:

$ docker-compose up --build

Stop entire stack:

$ docker-compose stop

Find Us

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Maintainers

Should you have any questions or concerns, please reach out to one of the project's Maintainers.

License

This work is licensed under a EUPL v1.2 license.