ARCHOS 525 BLUEPRINT · /d/dgm_code-repository-and-unit-of-work
Repository & Unit of Work Patterns (Atomic Persistence Boundaries)
6 COMPONENTS · 6 FLOWS · UPDATED 2026-11-24
GITHUB README / PR PREVIEW CARD
[](https://archos.sageideas.dev/d/dgm_code-repository-and-unit-of-work) *Interactive architecture diagram powered by [ArchOS Studio](https://archos.sageideas.dev/d/dgm_code-repository-and-unit-of-work)*
NOTION / DOCS / CONFLUENCE EMBED
<iframe src="https://archos.sageideas.dev/embed/dgm_code-repository-and-unit-of-work" width="100%" height="580" style="border:1px solid rgba(240,236,225,0.14);border-radius:6px;" loading="lazy" title="Repository & Unit of Work Patterns (Atomic Persistence Boundaries) — Interactive in ArchOS"></iframe>
PORTABLE MERMAID SPEC (GITHUB / NOTION / RFC)
flowchart LR
client_0["Application Use Case"]
n1_1["Unit of Work Scope"]
n2a_2["Aggregate Repository"]
n2b_3[("Dirty / Outbox Tracker")]
n3_4[("Atomic DB Commit")]
downstream_5["Downstream & OTel"]
client_0 -->|"1. BEGIN TX · TX"| n1_1
n1_1 -->|"2a. Load/Save · Repo"| n2a_2
n1_1 -->|"2b. Stage ops · Track"| n2b_3
n2a_2 -->|"3a. COMMIT · SQL"| n3_4
n2b_3 -->|"3b. Merge · RAM"| n3_4
n3_4 -.->|"4. Emit / · OTLP/API"| downstream_5COMPONENT STACK (6)
- Application Use CaseSTATELESSLoad -> Mutate -> Commit
- Unit of Work ScopeSTATELESSOwns 1 DB TX lifecycle
- Aggregate RepositorySTATELESSgetById / save domain API
- Dirty / Outbox TrackerSTATEFULQueues entity + outbox writes
- Atomic DB CommitSTATEFULCOMMIT all or ROLLBACK cleanly
- Downstream & OTelSTATELESSConsumers, metrics & SLOs
REQUEST & DATA FLOW (6)
- Application Use Case → Unit of Work Scope (BEGIN TX)[TX]
- Unit of Work Scope → Aggregate Repository (Load/Save)[Repo]
- Unit of Work Scope → Dirty / Outbox Tracker (Stage ops)[Track]
- Aggregate Repository → Atomic DB Commit (COMMIT)[SQL]
- Dirty / Outbox Tracker → Atomic DB Commit (Merge)[RAM]
- Atomic DB Commit → Downstream & OTel (Emit /)[OTLP/API]