Skip to main content
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
[![Repository & Unit of Work Patterns (Atomic Persistence Boundaries) — ArchOS Architecture](https://archos.sageideas.dev/d/dgm_code-repository-and-unit-of-work/opengraph-image)](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_5

COMPONENT STACK (6)

  • Application Use CaseSTATELESS
    Load -> Mutate -> Commit
  • Unit of Work ScopeSTATELESS
    Owns 1 DB TX lifecycle
  • Aggregate RepositorySTATELESS
    getById / save domain API
  • Dirty / Outbox TrackerSTATEFUL
    Queues entity + outbox writes
  • Atomic DB CommitSTATEFUL
    COMMIT all or ROLLBACK cleanly
  • Downstream & OTelSTATELESS
    Consumers, metrics & SLOs

REQUEST & DATA FLOW (6)

  1. Application Use Case → Unit of Work Scope (BEGIN TX)[TX]
  2. Unit of Work Scope → Aggregate Repository (Load/Save)[Repo]
  3. Unit of Work Scope → Dirty / Outbox Tracker (Stage ops)[Track]
  4. Aggregate Repository → Atomic DB Commit (COMMIT)[SQL]
  5. Dirty / Outbox Tracker → Atomic DB Commit (Merge)[RAM]
  6. Atomic DB Commit → Downstream & OTel (Emit /)[OTLP/API]
Configure NGINX / Postgres / K8s →60-Sec L4–L7 Diagnostic →