Getting started
Install
Section titled “Install”pnpm add effect-cqrs effectIt needs Node 24 or later and Effect 4. To store events in SQLite or PostgreSQL, add
that database’s effect/sql driver too:
pnpm add @effect/sql-sqlite-nodepnpm add @effect/sql-pgEverything is exported from effect-cqrs, and each module also has its own path, such
as effect-cqrs/ViewModel.
Try the examples
Section titled “Try the examples”The examples live in the repository, where they import the TypeScript sources directly.
-
Clone the repository and install the dependencies. It needs pnpm.
Terminal window git clone https://github.com/davidnussio/effect-cqrs.gitcd effect-cqrspnpm install -
Run the tests.
Terminal window pnpm test -
Run the todo example. It is the moleculer-cqrs README walkthrough as a program, on an in-memory SQLite database.
Terminal window pnpm example -
Serve the bank demo at http://localhost:5173.
Terminal window pnpm ui
What’s where
Section titled “What’s where”Directorysrc/
- Aggregate.ts defines aggregates
- AggregateService.ts runs commands and reads state and history
- ViewModel.ts projects events into read models
- Checkpoints.ts remembers how far each view model has read
- EventStore.ts the log, and the store in memory
- SqliteEventStore.ts
- PostgresEventStore.ts
- Fixture.ts tests an aggregate in isolation
Directoryexamples/
Directorytodo/ the moleculer-cqrs walkthrough
- …
Directorybank-ui/ the bank demo, in the browser
- …
Directorybench/ performance and stress tests, and their report
- …
Directorytest/
- …