43 lines
1.9 KiB
Markdown
43 lines
1.9 KiB
Markdown
# Clean Architecture layer contract
|
|
|
|
The import direction is `domain <- application <- presentation`; concrete
|
|
adapters implement application-owned ports and are assembled only in
|
|
`src/bootstrap`.
|
|
|
|
| Layer | Owns | May depend on |
|
|
| --- | --- | --- |
|
|
| `domain` | framework-neutral models and pure policies | domain siblings |
|
|
| `application` | use cases, ports, orchestration, view-models | domain and application siblings |
|
|
| `presentation` | routes, components, user interaction and view state | application public API and shared UI |
|
|
| `adapters` | browser and third-party implementations of application ports | application ports and limited domain values |
|
|
| `bootstrap` | runtime configuration, adapter construction and React mount | all selected runtime modules |
|
|
|
|
The following edges are forbidden:
|
|
|
|
- domain to application, presentation, adapters, bootstrap, React, or browser globals
|
|
- application to presentation, concrete adapters, bootstrap, React, or browser globals
|
|
- presentation to concrete adapters, raw DTO schemas, or storage implementations
|
|
- an adapter to presentation, bootstrap internals, or another concrete adapter
|
|
|
|
`bootstrap` contains composition only. Business rules and page-specific
|
|
orchestration belong to domain/application.
|
|
|
|
This table is the current coarse-grained rule. The
|
|
[ports, adapters, and feature-boundary target](./frontend-ports-adapters-and-boundaries.md)
|
|
defines the missing application input boundary, explains that `presentation`
|
|
acts as the inbound adapter, and separates current outbound adapters from
|
|
project-selected capabilities. The
|
|
[platform capability review](./frontend-platform-capability-review.md) records
|
|
where the current composition still bypasses this intended rule.
|
|
|
|
Architecture reports use this shape:
|
|
|
|
```json
|
|
{
|
|
"schemaVersion": 1,
|
|
"generatedAt": "ISO-8601",
|
|
"rules": [{ "name": "rule-id", "severity": "error", "violations": 0 }],
|
|
"summary": { "errors": 0, "warnings": 0 }
|
|
}
|
|
```
|