Application Layer
The Application Layer orchestrates use cases without containing business logic. It coordinates between Presentation (controllers) and Domain (entities, value objects).
In This Section
- Commands & Handlers - Write operations via CommandBus
- Queries & Handlers - Read operations via QueryBus
- Use Cases - Direct mode pattern
- Controllers - HTTP orchestration
- Event Listeners - React to domain events
Layer Responsibilities
- Receive requests from controllers
- Coordinate domain operations
- Manage transactions
- Dispatch domain events
- Return responses for presentation
Two Architectural Modes
| Mode | Pattern | Best For |
|---|---|---|
| Bus Mode | Commands/Queries via buses | Complex operations, domain events, transactions |
| Direct Mode | UseCase classes | Simple operations, no events needed |
Both modes coexist in the same application. See Architectural Modes for guidance.
Key Principles
- No Domain Logic: Business rules belong in the Domain Layer
- Thin Controllers: Controllers orchestrate only, no business logic
- Immutable Messages: Commands, Queries, and Responses are readonly
- Event-Driven: Publish events after successful operations