Search docs
Docs searchValidation rule
Back to Rule CatalogAP-APP-001Application LayeringController contains business logic
Flags controllers that contain business decisions instead of delegating to application services.
warningviolationNo auto-fix
How to fix
- Move business decisions into an application service.
- Keep the controller focused on transport concerns.
- Add focused service tests for the moved behavior.
What the rule validates
A controller appears to do more than request parsing, authorization handoff, and response shaping.
Why it matters
Keeping controllers thin makes business behavior easier to test, reuse, and govern.
Common causes
- Validation, branching, or persistence logic was added directly to a route handler.
- A small endpoint grew without moving behavior into a service.
- Controller code copied a service workflow inline.
Typical violation example
A controller computes billing eligibility, writes records, and sends email in the route method.Typical compliant example
The controller validates request shape and calls BillingService.startCheckout(...).Related rules
AP-APP-002 - Repository contains business logicAP-APP-003 - Service bypasses repository layerAP-APP-004 - Package responsibility mismatchAP-APP-005 - Service has oversized responsibility
Adjacent categories
Related files/config
apps/api/srcapps/webpackages
Related CLI commands
archpilot validatearchpilot validate --ci