nw-ddd-eventsourcing

Guide architects on applying Event Sourcing and CQRS in domain-driven design.

Updated Apr 15, 2026
One-click install
npx skills add https://github.com/StudentCristian/nWave-github --skill nw-ddd-eventsourcing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nw-ddd-eventsourcing
Source: https://github.com/StudentCristian/nWave-github/tree/main/.github/skills/nw-ddd-eventsourcing
Command: npx skills add https://github.com/StudentCristian/nWave-github --skill nw-ddd-eventsourcing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide helps software teams decide when to apply Event Sourcing and CQRS within domain-driven design, and explains the core concepts, patterns, and tradeoffs.

Core Features & Use Cases

  • Event Sourcing stores every state change as an immutable event and derives current state from replay.
  • CQRS separates write and read models to optimize for commands and queries.
  • Includes guidance on aggregates, projections, snapshots, sagas, upcasting, conflict resolution, and testing approaches for ES/DDD.

Quick Start

Outline an ES/CQRS implementation plan for a domain with audit requirements and multiple read models.

Frequently Asked Questions about nw-ddd-eventsourcing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
When should I use event sourcing and CQRS in domain-driven design?

Event sourcing and CQRS are recommended in domain-driven design for domains needing audit trails, temporal queries, and multiple read views across services. They separate write and read models to optimize command and query operations while storing state changes as immutable events.

How do I design aggregates and projections for an event-sourced system?

Design aggregates as transactional boundaries that emit domain events, and build projections to translate those events into queryable read models. This pattern ensures current state is derived by replaying events while projections serve specific query needs.

What is event upcasting and how does it handle schema evolution in event stores?

Event upcasting handles schema evolution in event stores by transforming older event versions to newer schemas during replay. This pattern ensures backward compatibility when domain models evolve without breaking existing event streams.

How do I resolve conflicts in an event-sourced aggregate?

Conflict resolution in an event-sourced aggregate involves detecting concurrent modifications when appending events to the stream. This requires optimistic concurrency control and applying business logic to merge or reject conflicting state changes.

What testing strategies work best for CQRS and event sourcing implementations?

Testing strategies for CQRS and event sourcing focus on aggregate behavior validation through event replay and verifying projection consistency. This includes testing command handlers, event emission, and ensuring read models accurately reflect the event stream.

When should I avoid using event sourcing in my architecture?

Avoid event sourcing when your domain lacks audit requirements, has simple CRUD operations, or when temporal queries and multiple read views are unnecessary. The operational complexity of event stores and projections outweighs benefits for straightforward state management.