TypeScript CQRS/Event Sourcing toolkit for Node.js (v1.1.0, monthly releases). Provides command/event buses, sagas, projections, dependency injection, and optional adapters for RabbitMQ, Redis, MongoDB, SQLite, and OpenTelemetry. Differentiators: first-class TypeScript support, lightweight core with pluggable persistence, and built-in saga orchestration. Suitable for domain-driven design (DDD) and event-sourced architectures.
npm install node-cqrsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates an in-memory event store, event bus, and command bus; registers a handler and dispatches a command.
Update package.json: { "type": "module" }. Use import syntax, not require().Replace import X from 'node-cqrs' with import { X } from 'node-cqrs'.Use MongoEventStore, RedisEventStore, or SqliteEventStore for persistence.
Pass { workerPool: true } to EventBus constructor to enable parallel processing.Define event types as const objects or TypeScript enums, e.g., const OrderCreated = 'OrderCreated' as const.
Install @opentelemetry/instrumentation-http and @opentelemetry/sdk-trace-node; register before importing node-cqrs.
npm install node-cqrs && ensure package.json has "type": "module".
Use named import: import { CommandBus } from 'node-cqrs'.Provide uri with username/password: mongodb://user:pass@host:port/db.
Ensure saga is added via eventBus.registerSaga(saga) and event type strings exactly match.