docs: define repository pattern boundary
This commit is contained in:
@@ -97,6 +97,28 @@ Domain code should not depend on delivery mechanisms, databases, network
|
||||
clients, or framework-specific runtime concerns unless the project intentionally
|
||||
uses an architecture where that trade-off is accepted and recorded.
|
||||
|
||||
## Persistence Boundary
|
||||
|
||||
The default persistence boundary is the repository pattern.
|
||||
|
||||
Use repositories to express domain-specific persistence operations without
|
||||
leaking database, ORM, file-system, or external storage details into application
|
||||
or domain logic.
|
||||
|
||||
Default rules:
|
||||
|
||||
- Application or domain-facing code depends on repository interfaces.
|
||||
- Infrastructure implements repository interfaces.
|
||||
- Repositories are named around domain concepts, not database tables.
|
||||
- Repositories expose intention-revealing operations, not generic CRUD by
|
||||
default.
|
||||
- Transaction boundaries are explicit at the application service, unit of work,
|
||||
or framework boundary selected by the project.
|
||||
|
||||
If a project intentionally avoids repositories because the framework or
|
||||
architecture provides a better persistence boundary, record that decision in
|
||||
[DECISIONS.md](DECISIONS.md).
|
||||
|
||||
## Request Flow
|
||||
|
||||
```mermaid
|
||||
|
||||
Reference in New Issue
Block a user