xiaohongshu
xiaohongshu
aurora-cqrs
Aurora CQRS Architecture Reference - Understanding the CQRS structure, component relationships, editable zones, and data flow in Aurora/NestJS projects. Trigger: When needing to understand CQRS architecture, component structure, or editable zones.
Full skill instructions
Use this skill as a REFERENCE when:
⚠️ For IMPLEMENTING business logic in handlers, use aurora-development skill
instead.
This skill is for UNDERSTANDING the architecture. The aurora-development skill
is for WRITING code.
CQRS (Command Query Responsibility Segregation) separates read operations (Queries) from write operations (Commands).
Aurora implements CQRS using NestJS CQRS module with:
┌─────────────────────────────────────────────────────────────┐
│ @api Layer (REST/GraphQL) │
│ Controllers/Resolvers → Handlers → dispatch Commands/Queries│
└─────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ @app/application Layer │
│ Commands → CommandHandlers → Services │
│ Queries → QueryHandlers → Services │
│ Events → EventHandlers │
│ Sagas → React to events │
└─────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ @app/domain Layer │
│ Aggregates (Entities with events) │
│ Value Objects (Immutable types) │
│ Repository Interfaces │
│ Mappers (Domain ↔ Response) │
└─────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ @app/infrastructure Layer │
│ Repository Implementations (Sequelize/TypeORM) │
│ Seeders, Models │
└─────────────────────────────────────────────────────────────┘
@api handlers (REST controllers, GraphQL resolvers, handler classes in @api/) have ONE job:
commandBus.dispatch() or queryBus.ask()@api handlers MUST NOT contain:
If you find yourself writing if/throw logic in an @api handler, STOP. That
logic belongs in a CommandHandler in @app/.
⚠️ WARNING about codebase examples: Some IAM @api handlers (e.g.,
iam-update-me-account.handler.ts, iam-check-password-me-account.handler.ts)
contain business logic directly in @api. These are LEGACY cross-module
orchestration handlers, NOT a pattern to replicate. For domain operations
(provision, cancel, approve, etc.), ALWAYS create Command + Handler + Service in
@app/application/<operation>/.
In Aurora-generated files, you can ONLY edit the execute() method body in
handlers.
DO NOT modify:
Always mark custom code with AI-generated comments:
/* #region AI-generated code */
// Custom logic here
/* #endregion AI-generated code */
For detailed structures, types, and handler examples, see:
Operation changes state?
├─ YES → Use Command
│ ├─ Create → CreateXCommand + CreateXCommandHandler
│ ├─ Update → UpdateXCommand + UpdateXCommandHandler
│ ├─ Delete → DeleteXCommand + DeleteXCommandHandler
│ └─ Upsert → UpsertXCommand + UpsertXCommandHandler
│
└─ NO → Use Query
├─ Single record → FindXQuery + FindXQueryHandler
├─ Multiple records → GetXQuery + GetXQueryHandler
├─ Paginated → PaginateXQuery + PaginateXQueryHandler
└─ Aggregate → CountXQuery / MaxXQuery / MinXQuery / SumXQuery
Need validation before save?
└─ Add in CommandHandler.execute() before service call
Need to react to events?
└─ Create EventHandler
Need to coordinate multiple operations?
└─ Create Saga
Need to transform data?
└─ Use Mapper
Need custom query logic?
└─ Add in QueryHandler.execute() before/after service call
Need reusable business logic?
└─ Create custom Service and inject in Handler
Need a domain operation (provision, cancel, approve)?
└─ Create new Command + Handler + Service in @app/application/<operation>/
- @api handler ONLY dispatches the command
- Handler validates business rules
- Service handles persistence + events
/* #region AI-generated code */ commentsexecute() method body in handlersaggregate.commit())@aurorajs.dev/core exports CQMetadata, IRepository, etc..claude/skills/aurora-project-structure/SKILL.md.claude/skills/aurora-cli/SKILL.mdaurora-development - USE THIS for implementing business logic in
handlersaurora-project-structure - Understand where CQRS components liveaurora-criteria - Build complex QueryStatements for queriestypescript - Type-safe implementationaurora-cli - Regenerate CQRS structure after YAML changesxiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience