-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Implementation of the Dynamic Consistency Boundary pattern for nodejs/typescript described by Sara Pellegrini
This repository contains the key concepts (event-store and event-handling) as well as specific implementations of each of these against different backend persistence layers (currently only Postgres). There is also an example CLI application, following Sara's Course/Students example implemented using this pattern.
It is important to have an understanding of the concepts of event-sourcing and projections before you start. Additionally read the article series above from Sara. An understanding of Domain Driven Design concepts such as the Aggregate (though we pretty much eliminate this here), Entities and Consistency Boundaries will help.
The purpose of this event-store and event-handling libraries are to fulfil the following:
- Querying the event-store in a Command Handler prior to appending events to determine if the system is in a valid state.
- Publishing new events to the event-store, while guaranteeing no relevant events have been added in the meantime (avoids race conditions).
- Enable a registry of Event Handlers (e.g. Projections, Process Managers) to update state or take other actions based on events. These can be updated synchronously with event publishes if required, avoiding the complexities of eventual consistency.
Licensed under an MIT license