Repository Standard¶
Executive Summary¶
Repository Standard defines module-owned persistence rules for the Spring Boot Modulith. PostgreSQL is the primary operational database, and repositories are private to the module that owns the data.
Repository Rules¶
| Rule | Requirement |
|---|---|
| Module private | Repositories are not injected into other modules. |
| Source fact ownership | Repositories persist only source facts owned by the module. |
| Tenant filtering | Repositories enforce tenant and organization context for customer data. |
| No cross-module joins for ownership | Cross-module reads require APIs, events, projections, or approved query contracts. |
| Migrations follow ownership | Schema changes are owned by the owning module. |
| Audit support | Material data changes must produce audit evidence where required. |
Persistence Boundary¶
flowchart LR
Module[Owning Module]
Repository[Private Repository]
PostgreSQL[(PostgreSQL Owned Records)]
Other[Other Module]
Event[Event or API Contract]
Module --> Repository
Repository --> PostgreSQL
Module --> Event
Event --> Other
Forbidden Patterns¶
- One module writing another module's table.
- One module querying another module's repository.
- Shared generic repositories for business data.
- Treating Analytics, search, or AI memory as operational source facts.