Nimbus EventSourcingDB Package
The EventSourcingDB package provides a seamless integration between Nimbus and EventSourcingDB. It offers a managed client, event reading and writing with automatic Nimbus event mapping, event observers that feed checkpointed consumers with retry logic, and built-in OpenTelemetry tracing.
The package requires the official eventsourcingdb SDK (version 2 or later) as a peer dependency. The SDK works with EventSourcingDB 1.3+ (v2 API) as well as older versions (v1 API) and detects the API at runtime. See Client Setup for details.
Upgrading from the eventsourcingdb 1.x SDK
If you upgrade an existing application, read the SDK migration guide.
For Nimbus users the relevant changes are the following.
- Server errors are
DbApiErrorinstances with acode. Replace checks likeerror.message.includes("409")witherror instanceof DbApiError && error.code === ErrorCode.preconditionViolated(see Write Events). - Writes whose outcome is unknown throw an
OutcomeUnknownErrorwhosecauseis the original error. - Observers no longer end quietly when the server closes the stream; Nimbus reconnects according to
connectionRetryOptions(see Event Observer). - Proxies in front of EventSourcingDB 1.3+ must allow the HTTP method
QUERY. writeEventsnow returns the written events instead ofvoid.
npm
npm install @nimbus-cqrs/eventsourcingdbpnpm
pnpm add @nimbus-cqrs/eventsourcingdbBun
bun add @nimbus-cqrs/eventsourcingdbDeno
deno add npm:@nimbus-cqrs/eventsourcingdbExample Application
An in Depth Example
This guide also has an in depth example of a working application built with Nimbus. Combining DDD, CQRS and Event Sourcing.
Check out the In Depth Example page to learn how everything is connected and works out in a real-world application.