---
title: "NestJS Event Store"
tagline: "Event sourcing"
language: "TypeScript"
license: "MIT"
since: "2019"
canonical: "https://xraph.com/work/nestjs-event-store"
---

# NestJS Event Store

A NestJS CQRS module that speaks to EventStoreDB, with persistent subscriptions, catch-up subscriptions, and the plumbing that makes @nestjs/cqrs durable. Pulled out of Ultimate Backend once people started asking for only that part.

## Install

```bash
pnpm add @juicycleff/nestjs-event-store
```

## What it is

A NestJS CQRS module for EventStoreDB. It gives @nestjs/cqrs a durable event store: persistent and catch-up subscriptions, projections, and the wiring between them.

## Where it came from

It was the event-sourcing layer inside Ultimate Backend. People kept opening issues asking how to use only that part, which is a reliable signal that a piece wants to be its own package.

## What it taught me

Event sourcing is straightforward until you need to change an event's shape. Versioning events, upcasting old ones on read, and deciding whether a projection rebuild is safe are the actual work, and none of them are visible in a tutorial. That lesson is directly upstream of Fabriq's decision to make every event versioned and every projection rebuildable from the start rather than as a later retrofit.

---

*Unpublished draft. Not peer reviewed and not submitted to a venue.*


## Anatomy

- **Streams**: Event streams bound to NestJS modules.
- **Projections**: Handlers subscribed by stream and type.

## Constraints and trade-offs

- (known gap) It taught me that event sourcing is a read-model problem long before it is a write problem.
