Architecture Documentation, ADRs, and Runbooks
Documentation explains how a system works, why a decision was made, and what to do first during an outage. Diagram freshness, decision records, and operational procedures should share one ownership model.
Quick Decision
| Need | Document | Watch out |
|---|---|---|
| Explain system boundaries | Context/container/component diagram | Include source and review date |
| Explain request or event flow | Sequence/data-flow diagram | Show sync/async boundaries |
| Record an architecture choice | ADR | State decision, alternatives, and outcome |
| Repeat an operation safely | Runbook | Include preconditions, commands, rollback |
| Catalog services | Service map | Owner, SLO, dependencies, and data owner |
Production Checklist
- Problem: Which decision or operational step does the document accelerate?
- Solution: Are owner, audience, scope, last-reviewed date, and source of truth clear?
- Trade-off: Detailed documentation is valuable; stale documentation creates false confidence.
- Failure mode: Handle stale diagrams, missing rollback, wrong alert steps, and hidden dependencies.
- Measurement: Track ADR review age, runbook success, incident MTTR, and broken links.
- Security/cost: Do not put secrets, private endpoints, or customer data in documents.
Architecture Views
Maintain these views when needed:
- Context: Users, external systems, and system boundary.
- Container/service: Services, queues, databases, caches, and ownership.
- Component: Modules inside a critical service and dependency direction.
- Sequence: Success, error/retry, async completion, and failover flows.
- Data flow: Movement from source of truth to projections, cache, backups, or analytics.
Every arrow should be meaningful through a protocol or event name, timeout/retry boundary, and failure boundary. Keep Mermaid diagrams easy to update; reduce drift with diagrams-as-code or source links when infrastructure changes.
Service Map and API Catalog
A service map should show owner/team, repository, runtime, region, SLO, data owner, inbound/outbound dependencies, auth method, deployment method, and alert links. An API catalog adds endpoint/schema owner, lifecycle, version, rate limits, examples, and deprecation date.
Use the same service ID across API Contracts and Tooling, observability, and incident processes.
ADR Format
An ADR is a short, durable decision record:
# ADR-0042: Use a queue for order completion
Status: Accepted
Date: 2026-09-03
Context: The work exceeds the request latency budget.
Decision: Use queue + worker + job status.
Alternatives: Synchronous call, scheduled batch
Consequences: Eventual consistency, retry, and DLQ operationsAn ADR is not a copy of the implementation or a long tutorial. Its status may evolve through proposed, accepted, deprecated, and superseded; link a new decision rather than silently deleting the old one.
Runbook Design
Every runbook should follow this order:
- Impact: Which users, SLO, or region is affected?
- Signal: Where are the alert, dashboard, logs, and traces?
- Safety: Authorization, blast radius, maintenance window, and stop conditions.
- Diagnosis: Lowest-risk checks first.
- Mitigation: Actions and expected signals.
- Recovery: Rollback, replay, failover, or traffic shift.
- Verification: Validate SLO, errors, queue age, and user flow.
- Follow-up: Incident record, ADR, or permanent fix.
Use placeholders and dry-run output for commands; never include passwords, tokens, or broad destructive commands. Exercise runbooks regularly with production access owners.
Lifecycle
A code or infrastructure change should update its diagram, service map, ADR, or runbook in the same review. Quarterly reviews, post-incident validation, and broken-link checks reduce stale documents. Remove documents that no longer carry decision or operational value after cleaning their links.
