Skip to content
Paul Grimshaw edited this page Jun 5, 2024 · 9 revisions

Dynamic Consistency Boundary Event Store for Node.js/TypeScript

Implementation of the Dynamic Consistency Boundary pattern for Node.js/TypeScript as described by Sara Pellegrini.

This repository contains the key concepts (event store and event handling) and specific implementations for different backend persistence layers (currently only Postgres). There is also an example CLI application, following Sara's Course/Students example implemented using this pattern.

Prerequisites

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.

Purpose

The purpose of this event store and event-handling libraries is to fulfill 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 publishing if required, avoiding the complexities of eventual consistency.

License

Licensed under an MIT license.

Clone this wiki locally