G2 · Architecture Generations
Controllers
Grouping Related Operations

Overview
When handlers start duplicating validation, entity loading, or authorization—it's time to group. Controllers organize operations by entity or feature, reducing duplication and improving team coordination.
When to use
- Multiple operations on same entity
- Shared validation or authorization
- Team coordination around features
- API design requires grouping
Quick assessment
- Do multiple handlers share the same validation or entity loading?
- Are operations naturally grouped by entity or feature?
- Is team coordination becoming difficult with scattered handlers?
- Would API consumers benefit from grouped endpoints?
In practice
How it works
Make it work
Keep transport concerns at the edge. Dispatch a query or command and return a clean result; keep business decisions inside the domain.
The trade-off
Controllers can become dumping grounds. Business decisions need a dedicated domain home.
Is this controller organizing or deciding?
Key patterns
- One controller per entity or feature
- Shared validation and authorization
- Common entity loading
- Consistent error handling
Counter-patterns
- Fat controllers with business logic
- Controllers becoming dumping grounds
- Cross-entity operations in single controller
Reality check
Controllers organize code, but business logic still needs a home. When validation rules get complex or the same logic appears in multiple controllers, it's time for dedicated services.
NFR profile
- security
- 3/5
- usability
- 4/5
- performance
- 4/5
- reliability
- 3/5
- scalability
- 2/5
- testability
- 3/5
- availability
- 3/5
- extensibility
- 3/5
- maintainability
- 4/5