Architecture Decision Records (ADRs)
Write lightweight Nygard ADRs, understand the proposed/accepted/superseded lifecycle, and review a worked ADR for Next.js static export vs OpenNext on Cloudflare Workers.
TL;DR
An ADR (Architecture Decision Record) is a short, version-controlled markdown file capturing Context, Decision, and Consequences for a hard-to-reverse choice. Write one when changing your mind later would be expensive—and supersede old ADRs rather than rewriting history.
Why it exists
Six months after shipping, nobody remembers why you chose static export over SSR, or Postgres over SQLite. Without ADRs, new teammates (or AI agents) either repeat rejected debates or accidentally undo a constraint that existed for a real reason.
1. The Nygard ADR format
Michael Nygard's 2011 format fits in 20–40 lines of Markdown:
- Title: Short noun phrase (
ADR-0002: Deploy with OpenNext on Cloudflare Workers). - Status:
Proposed→Accepted→DeprecatedorSuperseded by ADR-XXXX. - Context: The forces at play (requirements, constraints, cost, team skills) in neutral prose.
- Decision: Active voice ("We will...").
- Consequences: All outcomes—good, bad, and neutral—including what becomes harder.
2. Status lifecycle
Proposed ──▶ Accepted ──▶ Superseded by ADR-XXXX
│ ▲
└──▶ Rejected └── (or Deprecated)- Proposed: Open in a PR for review; team can still push back.
- Accepted: Merged to
main. Treat as immutable—do not silently rewrite its decision later. - Superseded: When circumstances change, add a new ADR explaining the new context and update the old ADR's status line to
Superseded by ADR-XXXX.
3. Worked example: Next.js static export vs OpenNext on Workers
This example summarizes a real decision in this repository (docs/deploy/CLOUDFLARE-WORKERS-PLAN.md superseding PLAN.md §2):
# ADR-0002: Deploy to Cloudflare Workers with OpenNext instead of Pages static export
## Status
Accepted (2026-11-26) — supersedes PLAN.md §2 (Cloudflare Pages `out/` export)
## Context
Mengty Learns started with `output: 'export'` on Next.js 16 + Fumadocs to deploy a pure
static `out/` folder to Cloudflare Pages with $0 backend cost. However, future features
(optional ISR, route handlers, and Cloudflare Workers' unified platform) are blocked by
`output: 'export'`. Cloudflare recommends vinext for brand-new apps, but this is an
existing Next.js 16.4.6 + Fumadocs 16 app.
## Decision
We will remove `output: 'export'` and deploy using `@opennextjs/cloudflare` on
Cloudflare Workers, while keeping every route statically prerendered (`generateStaticParams`
and `dynamic = 'force-static'`) and configuring `staticAssetsIncrementalCache` with
`enableCacheInterception: true` and `images.unoptimized: true`.
## Consequences
- Good: Zero storage cost ($0—no R2, KV, or D1 needed while all routes remain static).
- Good: Room to adopt ISR or middleware later without switching hosts.
- Good: Security headers (`public/_headers`) and immutable `/_next/static/*` caching work at the edge.
- Trade-off: Ships a Worker bundle (must stay under the 3 MiB gzip free-plan limit) instead of plain HTML files.
- Trade-off: OpenNext builds run on Linux CI (`ubuntu-latest`), as Windows support is not guaranteed.Minimum viable version (1–3 person team + AI agents)
- Store ADRs in
docs/adr/0001-short-title.md(or a Decisions table inPLAN.mdfor tiny projects). - Aim for 15 minutes to write, ≤ 1 page long.
- Include ADRs in your AI agent context (
AGENTS.mdordocs/adr/) so agents don't propose architectures you already ruled out.
When it's overkill
- Writing an ADR for reversible choices (variable naming, button padding, swapping an internal helper).
- Creating a formal Architecture Review Board that meets once a month and blocks PRs waiting for ADR sign-off.
Gotchas
- Hiding negative consequences: An ADR that only lists pros is marketing, not engineering. Always record the trade-offs and operational cost.
- Editing accepted ADRs in place: Changing "We chose A" to "We chose B" erases the history of why A was chosen and why it stopped working. Always supersede.
- Writing ADRs after everyone forgot: Draft the ADR in the same PR (or design step) where the decision is made.
Production checklist
- Hard-to-reverse decisions (hosting, auth, database, public API shape) have a numbered ADR.
- Every ADR lists Consequences honestly, including downsides and operational limits.
- Superseded ADRs link forward to the new ADR number.
- The ADR lives in Git right next to the code, not in a private chat thread.
Check yourself
Check Yourself
1. You accepted ADR-0001 (Use static export) six months ago, and today you decide to switch to OpenNext on Workers. What should you do with ADR-0001?
2. Which of these changes warrants an ADR for a 2-person team?
Sources
Related Notes
RACI Matrix for Small Teams and AI Agents
Clear R/A/C/I definitions, the one-Accountable rule, a worked RACI table for Mengty Learns (owner, lead agent, worker agents, CI), and common pitfalls.
DoR, DoD, and Quality Gates
Practical Definition of Ready, Definition of Done, and measurable quality gates from PR to production—using Mengty Learns' real CI, labs, and Lighthouse/axe gates.