Architecture decision records
An ADR preserves the reason for a decision
An architecture decision record (ADR) documents a significant choice, the context that made it necessary and its consequences. It helps future maintainers understand why a design was selected instead of reopening the same debate with missing context. A proposed ADR is not implementation approval. Keep the decision history and create a superseding ADR when the choice changes rather than silently rewriting the past.
Northwind must choose between a managed application runtime with a managed database (A), a VM-based application with a managed database (B), and a lower-cost VM design without verified residency (C). All estimates below are fictional; no provider product has been selected. The decision owner is the service lead; security and operations owners review their requirements.
Make the data flow and trust boundaries visible
A data-flow diagram identifies actors, processing, stores and data movement. A trust boundary is where an identity, network or administrative trust assumption changes. This diagram is textual for accessibility; arrows represent intended data flows, not deployed connectivity.
[Customer] -- TLS request --> | Internet / service boundary | [API + authz] -- service identity --> [Order DB] | | | redacted events | backups v v [Restricted logs] [Backup vault] | | approved-region data boundary (DB, logs, vault)The API validates identity and enforces order-level authorization. The DB and vault are private and separate privileges control restore and routine application access. The audit trail records actions without including tokens or order payloads. Validate all data destinations, including diagnostic exports, support workflows and backup copies, rather than assuming a diagram enforces region residency.
| Threat or failure | Control | Evidence / residual risk |
|---|---|---|
| Customer requests another customer's order | Server-side authorization on each read/write | Denial test; policy drift remains possible |
| Credentials leak into logs | Redaction, restricted access, short-lived identity | Synthetic secret-marker test; future fields may bypass filters |
| Database becomes unavailable | Restore rehearsal, monitored backups | Checkpoint and recovery timing; simultaneous dependencies may fail |
| Report queries saturate checkout | Separate resource pools, queue and limits | Stress test; shared database can remain a bottleneck |
The threat model is an analysis of what could go wrong. A risk register tracks the remaining risk, owner, mitigation and decision. Neither artifact proves controls work.
Filter mandatory constraints before scoring preferences
Only compare eligible choices. Treat unverified mandatory evidence as unknown, not as passing. For learning, the following figures are scenario estimates, not actual load tests or prices. For the decision exercise, assume A and B have already satisfied the scenario residency review; no real service or certification is implied.
| Option | Monthly USD | Estimated p95 ms | Estimated RTO min / RPO min | Residency evidence |
|---|---|---|---|---|
| A | 1130 | 180 | 22 / 4 | Scenario pass |
| B | 1000 | 210 | 25 / 5 | Scenario pass |
| C | 800 | 150 | 20 / 4 | Unknown |
Require cost <= 1200, latency <= 250, RTO <= 30 and RPO <= 5, plus residency and an operational review. C is ineligible regardless of its attractive estimates. Passing this preliminary filter is not authorization to release: estimates must be replaced with actual acceptance evidence.
Use preference scores 1 (weak) through 5 (strong) based on documented reasoning. Fix weights before seeing the totals. Score A as [5, 4, 3] and B as [2, 4, 5] for operability, performance margin and cost preference respectively. The weights are [50, 30, 20] percent; the weighted score is sum(weight * score) / 100. A = 4.3; B = 3.2. If the weights change to [10, 30, 60], A = 3.5 and B = 4.4. This sensitivity check demonstrates that a ranking depends on stakeholder priorities. Do not tune the weights afterward to justify a preferred answer. Avoid scoring unverified data with false precision, and keep source evidence and justification for each rating.
Offline decision matrix: executable teaching example
Run this Python 3 standard-library example locally. The model accepts explicitly supplied scenario gate states, not provider permissions or real test results. It rejects missing/invalid inputs and filters failed or unknown gates before ranking. Equal scores remain tied; a human must choose or refine the evidence.
GATES = ('cost', 'latency', 'recovery', 'residency', 'operations')
def weighted_points(ratings, weights): if len(ratings) != 3 or len(weights) != 3: raise ValueError('three criteria required') if any(type(x) is not int or not 1 <= x <= 5 for x in ratings): raise ValueError('ratings must be integers 1..5') if any(type(x) is not int or x < 0 for x in weights) or sum(weights) != 100: raise ValueError('weights must total 100') return sum(r * w for r, w in zip(ratings, weights))
def evaluate(states, ratings, weights): points = weighted_points(ratings, weights) if set(states) != set(GATES) or any(v not in ('pass', 'fail', 'unknown') for v in states.values()): raise ValueError('provide all gate states') if 'fail' in states.values(): return 'ineligible', None if 'unknown' in states.values(): return 'needs-evidence', None return 'candidate', points
ready = dict.fromkeys(GATES, 'pass')options = { 'A': (ready, [5, 4, 3]), 'B': (ready, [2, 4, 5]), 'C': (dict(ready, residency='unknown'), [5, 5, 5]),}for name, (states, ratings) in options.items(): status, points = evaluate(states, ratings, [50, 30, 20]) print(name, status, f'{points / 100:.2f}' if points is not None else '-')Expected output:
A candidate 4.30B candidate 3.20C needs-evidence -The model computes integer weighted points (430 means 4.30 out of 5), avoiding binary floating-point comparisons for ranking. Candidate means eligible for discussion, not approved for production. Change A's recovery gate to fail; no points are returned. Set an unknown gate on B and see why a missing test cannot be compensated by good ratings. Do not connect this demonstration to a deployment pipeline.
Example ADR-053: choose a managed application runtime
| Field | Fictional proposed record |
|---|---|
| ID and status | ADR-053, Proposed, 2026-11-28 |
| Context | Order API, R1-R6 from previous lesson, small operations team |
| Alternatives | A managed runtime + managed DB; B VM + managed DB; C unverified residency |
| Decision | Prefer A for the pilot, conditional on measured acceptance; no deployment approval |
| Rationale | A scores 4.30 vs B 3.20 with agreed weights; C blocked by missing residency evidence |
| Positive consequences | Reduced host maintenance; more time for application operations |
| Negative consequences | Runtime constraints, platform dependency, higher modeled cloud charge than B |
| Verification | Load, restore, authorization, location, budget, runbook evidence; record date and owner |
| Revisit trigger | Failed acceptance, changing workload, new contractual constraint, or forecast above ceiling |
| History | Proposed by fictional service lead; reviewer approval pending |
Use an explicit status such as proposed, accepted, rejected or superseded; define the organization's actual status process. Accepted ADRs document a decision, not a security or compliance certification. The pilot recommendation is conditional; actual acceptance is still unknown. If B becomes better after a change in requirements, create a successor with a link to this ADR and mark this one superseded once approved. See AWS ADR FAQ and ADR history guidance.
Residual risks and acceptance
| Risk ID | Residual risk after planned control | Owner | Action / evidence | Review trigger |
|---|---|---|---|---|
| K1 | Runtime-specific integrations complicate exit | Platform | Export and redeploy exercise | API/runtime change |
| K2 | Cost rises with unexpected data transfer | Finance | Volume-sensitive forecast and alerts | Forecast > 1200 |
| K3 | Shared database remains a failure domain | Operations | Saturation drill and recovery test | Incident or capacity change |
| K4 | Sensitive fields added to logs later | Security | Redaction regression tests and access review | Schema change |
Use agreed risk criteria (likelihood and impact definitions), name the risk owner and require explicit acceptance of residual risks. Ordinal risk levels are not precise probabilities; multiplying arbitrary labels does not measure expected loss. For acceptance, record actual load conditions, RPO/RTO measurements, positive and negative authorization cases, data-flow inventory and alert drill evidence. The decision remains proposed until responsible reviewers resolve the mandatory requirements. No formal architecture review or audit has occurred.
Practice: run the code, change the weights to the alternate set, mark one mandatory state unknown and write a successor proposal explaining the changed ranking. Add a risk with a named role, mitigation, verification and trigger. Keep the old decision history intact. Next: SaaS architecture and multi-tenant systems.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Architecture decision records — knowledge check
Choose the best answer for each offline scenario.
An option has excellent ratings but unknown residency evidence. What should the example return?
Ratings [5, 4, 3] and weights [50, 30, 20] produce what score?
When a later approved decision changes the architecture, how should history be handled?
What does candidate from the offline model mean?
Which artifact records remaining risk with an owner and review trigger?