Skip to content

Architecture Map

Interactive visual architecture and dependency graph of all @cqrs-ddd packages, pipeline behaviors, domain event flow, and the reference API application.

Archify Interactive Architecture Map Open full-screen ↗
  • @cqrs-ddd/cqrs: Builds lightweight CommandBus, QueryBus, and EventBus via createCqrs() without framework DI containers.
  • @cqrs-ddd/pipeline: Encapsulates cross-cutting execution behaviors (LoggingBehavior, CacheBehavior, CaslBehavior, etc.) around domain handlers.
  • Contract-Based Request Kinds: Request routing uses Symbol.for('@cqrs-ddd/request-kind') to avoid direct coupling between pipeline and domain layers.
  • Buffered Domain Events: Aggregates buffer domain events (UserCreatedEvent, UserUpdatedEvent, RoleCreatedEvent, etc.) during state mutations.
  • Automatic Event Dispatch: CommandBaseHandler automatically publishes buffered events through EventBus after durable persistence succeeds.
  • Context-Preserving Queues: BullMqUserEventDispatcher packages messages with withJobContext(), preserving caller tenant, principal, and correlation IDs across Redis queues.
  • Isolated Processors: Background job workers (SendWelcomeEmailProcessor, BatchUpdateUsersProcessor) execute decorated with @InJobContext, restoring the full execution context without leaking between jobs.
  • @cqrs-ddd/core: Framework-neutral DDD primitives (AggregateRoot, Entity, ValueObject, DomainEvent, domain errors) with zero dependencies.
  • @cqrs-ddd/mikro-orm: Implements write-side repository abstractions with version-conditioned optimistic concurrency (optimisticUpdate) and anti-resurrection mutation barriers.
  • Two-Layer Caching: Repository entity snapshot caching (@FromCache, @Cache) is kept separate from composed pipeline response caching (CacheBehavior).
  • api/: Reference REST application demonstrating dual Express and Fastify adapters, multi-tenant isolation, BullMQ background workers, and session management.