63 lines
1.2 KiB
Markdown
63 lines
1.2 KiB
Markdown
# 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
|
|
|
|
1. Use Cases contain business logic.
|
|
2. Use Cases enforce invariants.
|
|
3. Use Cases do not know about HTTP.
|
|
4. Use Cases do not know about UI.
|
|
5. Use Cases do not depend on delivery-layer presenters.
|
|
6. Use Cases do not accept or return HTTP DTOs.
|
|
|
|
## 3) Inputs and outputs
|
|
|
|
Inputs:
|
|
|
|
- plain data and/or domain types
|
|
|
|
Outputs:
|
|
|
|
- a `Result` containing 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`](docs/architecture/api/USE_CASE_WIRING.md:1)
|
|
|
|
## 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.
|
|
|
|
See [`docs/architecture/core/CQRS.md`](docs/architecture/core/CQRS.md:1).
|
|
|