docs
This commit is contained in:
92
docs/architecture/core/CORE_DATA_FLOW.md
Normal file
92
docs/architecture/core/CORE_DATA_FLOW.md
Normal file
@@ -0,0 +1,92 @@
|
||||
# Core Data Flow (Strict)
|
||||
|
||||
This document defines the **Core** data flow rules and boundaries.
|
||||
|
||||
Core scope:
|
||||
|
||||
- `core/**`
|
||||
|
||||
Core does not know:
|
||||
|
||||
- HTTP
|
||||
- Next.js
|
||||
- databases
|
||||
- DTOs
|
||||
- UI models
|
||||
|
||||
## 1) Layers inside Core
|
||||
|
||||
Core contains two inner layers:
|
||||
|
||||
- Domain
|
||||
- Application
|
||||
|
||||
### 1.1 Domain
|
||||
|
||||
Domain is business truth.
|
||||
|
||||
Allowed:
|
||||
|
||||
- Entities
|
||||
- Value Objects
|
||||
- Domain Services
|
||||
|
||||
Forbidden:
|
||||
|
||||
- DTOs
|
||||
- frameworks
|
||||
- IO
|
||||
|
||||
See [`docs/architecture/core/DOMAIN_OBJECTS.md`](docs/architecture/core/DOMAIN_OBJECTS.md:1).
|
||||
|
||||
### 1.2 Application
|
||||
|
||||
Application coordinates business intents.
|
||||
|
||||
Allowed:
|
||||
|
||||
- Use Cases (commands and queries)
|
||||
- Application-level ports (repository ports, gateways)
|
||||
|
||||
Forbidden:
|
||||
|
||||
- HTTP
|
||||
- persistence implementations
|
||||
- frontend models
|
||||
|
||||
## 2) Core I/O boundary
|
||||
|
||||
All communication across the Core boundary occurs through **ports**.
|
||||
|
||||
Rules:
|
||||
|
||||
- Port interfaces live in Core.
|
||||
- Implementations live outside Core.
|
||||
|
||||
## 3) Core data types (strict)
|
||||
|
||||
- Use Case inputs are plain data and/or domain types.
|
||||
- Use Case outputs are plain data and/or domain types.
|
||||
|
||||
Core MUST NOT define HTTP DTOs.
|
||||
|
||||
## 4) Canonical flow
|
||||
|
||||
```text
|
||||
Delivery App (HTTP or Website)
|
||||
↓
|
||||
Core Application (Use Case)
|
||||
↓
|
||||
Core Domain (Entities, Value Objects)
|
||||
↓
|
||||
Ports (repository, gateway)
|
||||
↓
|
||||
Adapter implementation (outside Core)
|
||||
```
|
||||
|
||||
## 5) Non-negotiable rules
|
||||
|
||||
1. Core is framework-agnostic.
|
||||
2. DTOs do not enter Core.
|
||||
3. Core defines ports; outer layers implement them.
|
||||
|
||||
Reference in New Issue
Block a user