1.2 KiB
1.2 KiB
Use Cases (Core Application Boundary) (Strict)
This document defines the strict rules for Core Use Cases.
Scope:
core/**
Non-scope:
- HTTP controllers
- DTOs
- Next.js pages
1) Definition
A Use Case represents one business intent.
It answers:
- what the system does
2) Non-negotiable rules
- Use Cases contain business logic.
- Use Cases enforce invariants.
- Use Cases do not know about HTTP.
- Use Cases do not know about UI.
- Use Cases do not depend on delivery-layer presenters.
- Use Cases do not accept or return HTTP DTOs.
3) Inputs and outputs
Inputs:
- plain data and/or domain types
Outputs:
- a
Resultcontaining plain data and/or domain types
Rule:
- mapping to and from HTTP DTOs happens in the API, not in the Core.
See API wiring: docs/architecture/api/USE_CASE_WIRING.md
4) Ports
Use Cases depend on ports for IO.
Rules:
- port interfaces live in Core
- implementations live in adapters or delivery apps
5) CQRS
If CQRS-light is used, commands and queries are separated by responsibility.