Skip to content

    Frontend System Design

    Front-End Architecture Decision Records and Documentation

    Record front-end decisions in short ADRs, check them in CI, keep an append-only decision log, and sort the other documentation so new engineers can work safely.

    By Published 13 min read

    • frontend-system-design
    • architecture-decision-records
    • documentation
    • c4-model
    Share

    Standard lessonintermediateFrontend System Design

    Before this: Trade-Off Analysis for Front-End Decisions

    What you'll learn: By the end of this lesson you will be able to decide which front-end decisions deserve a written record, write one as a Y-statement or a short Nygard or MADR record, attach a check that fails when the decision is broken, keep an append-only log where a changed decision is superseded, draw a C4 container view of a front end, and sort the remaining documentation into four kinds so each has one job.

    A fuse box with no labels works until the day something trips. Then someone stands in the dark pressing switches. A label costs one line of ink when the box is wired, and saves an evening later. A front-end codebase is a fuse box. The code shows which switch is where. It does not say why the product page is rendered on the server, why the cart lives where it does, or why a script is banned. The reasons sit in a few heads, and heads move on.

    The back-end lesson on ADRs and C4 teaches the shared ideas in full: the record formats, the lifecycle and the four C4 levels. This lesson gives working definitions and covers what is specific to a browser application: which decisions to record, how to check them in a build, and how to document the rest. Choosing between options is the job of trade-off analysis; this lesson is about what you do with the answer.

    Verified on 2026-12-02 against adr.github.io, Nygard's 2011 post, the MADR site, the AWS and Azure ADR guidance, c4model.com, Diataxis and a published design-doc article. No code was run. Storefront names and numbers are illustrative.

    The core idea

    An architecture decision record (ADR) captures one decision and its reasons. A diagram shows where things are. Other documents teach, instruct or describe. A front end needs all three, and a front end also needs a way to notice when code stops obeying a record.

    The adr.github.io site defines an architectural decision as "a justified design choice that addresses a functional or non-functional requirement that is architecturally significant". An ADR "captures a single AD and its rationale", and the collection of records in a project is its decision log.

    Three illustrations run through the lesson:

    • Minimal example: a one-sentence Y-statement for a rendering decision.
    • Realistic example: a full record for state ownership on a storefront, with a CI check attached.
    • Failure example: an unrecorded decision undone by a well-meant change.

    Which front-end decisions deserve a record

    The Azure Well-Architected guidance gives the filter: include only choices that affect the system's structure or key quality attributes, or that are difficult to reverse. The AWS Prescriptive Guidance lists five areas: structure, non-functional requirements, dependencies, interfaces, and construction techniques such as libraries, frameworks and tools.

    Mapped onto a browser application, that gives a working list. A decision is a strong candidate when it is costly to undo because users, URLs, stored data or other teams depend on it.

    Area (AWS) Front-end decision Why it is hard to undo Where the topic is taught
    Structure Rendering strategy per page type URLs, caching and hydration all follow from it Choosing a rendering strategy
    Structure One app or several micro-frontends Team boundaries and deployment change Micro-frontends and Conway's law
    Non-functional Performance budgets, browser support, accessibility target Every later change is judged against them Performance budgets
    Dependencies Framework, state library, third-party scripts Spread through every file State libraries compared, Third-party scripts
    Interfaces Component API and design-system versioning Other teams build on it Design-system governance
    Interfaces Where tokens are stored A security property users rely on Token storage
    Construction Bundler, module boundaries, test strategy Tooling and conventions harden Module boundaries
    flowchart TD accTitle: Does this front-end decision need a record accDescr: A decision flow. If the choice does not affect structure or a key quality, it needs no record. If it is cheap to reverse and nobody else depends on it, a code comment is enough. Otherwise it needs a record, written before the change merges. A{"Does it change structure or
    a key quality such as speed,
    accessibility, security?"} -->|no| N["No record"] A -->|yes| B{"Hard to reverse, or do
    other teams or users
    depend on it?"} B -->|no| C["A code comment
    or pull request note"] B -->|yes| D["Write an ADR in the
    same pull request"]

    Figure 1. The test for a record. How to read this: two questions, in order. The first removes cosmetic choices. The second separates decisions a comment can hold from decisions that need alternatives, consequences and an owner.

    Anatomy of a record, front-end flavoured

    The Y-statement is one sentence. adr.github.io gives the short form as "In the context of <use case/user story>, facing <concern> we decided for <option> to achieve <quality>, accepting <downside>." The long form adds the options not chosen ("and neglected") and a closing "because" for extra rationale.

    Minimal example (illustrative). A Y-statement for a storefront:

    In the context of the product page, facing slow first paint on mid-range phones, we decided for generating the page ahead of time and revalidating it on a schedule, to achieve a fast and cacheable first response, accepting that price and stock shown at first paint can be stale and must be corrected on the client.

    One sentence names the page, the concern, the choice, the quality gained and the price paid. Note the price: a record with an empty "accepting" part has hidden its downside.

    Nygard's format has title, status, context, decision and consequences. His post says "All consequences should be listed here, not just the 'positive' ones", that records are numbered sequentially and never reused, and that "the whole document should be one or two pages long".

    MADR adds structure: considered options, decision drivers, pros and cons of each option, and an optional confirmation element, "describing how compliance with the decision is checked". Azure adds that a record should carry its confidence level, because a low-confidence decision is a candidate for later reconsideration.

    Name the client constraints

    The runtime is not yours, so a front-end context should name the client conditions that forced the choice: browser support policy, device class, network, accessibility target and budget. Without them the record reads as taste. With them a later engineer can test whether the constraint still holds; Azure notes that a record without justification loses its value because readers cannot judge whether the decision still applies.

    Make a record fail a build: the confirmation check

    A record nobody can verify decays into folklore. MADR's confirmation element asks how compliance will be checked. Many front-end decisions can be tied to a machine check:

    Decision Confirmation (illustrative)
    Entry bundle stays within a size budget A build step compares output size with the budget and fails the pull request
    Feature modules import only each other's public entry points A lint rule on import paths
    Third-party scripts load only from an approved list A test over the rendered document's script tags

    This table is a design suggestion; MADR only says the element exists. Each check should cite the record number in its failure message, so the person whose pull request fails lands on the reasons.

    A record, a check and a pull requestPull request to CI checks (runs); CI checks to Decision log (cites record); CI checks to Reviewers (passes); Reviewers to Main branch (approve)Pull request: code changePull requestcode changeCI checks: budget, lint, testsCI checksbudget, lint,testsDecision log: in the repositoryDecision login the repositoryReviewers: read the recordReviewersread the recordMain branch: mergedMain branchmergedrunscites recordpassesapprove

    Figure 2. A decision that checks itself. How to read this: the pull request runs the checks. A failing check points at the record that explains the rule, shown as the red dashed edge. A passing change goes to reviewers, who read the same log; AWS describes reviewers sharing a link to the record when a change violates it.

    The decision log: append-only, next to the code

    Nygard stored records in the project repository, using a path of the form doc/arch/adr-NNN.md and a lightweight markup such as Markdown. Azure asks for the log to be stored openly with the workload documentation, warning that "a decision that's made but never recorded will likely be forgotten, leading to repeated debates". Azure also says the log is append-only: do not edit accepted records; "write a new record that supersedes the original and link the two together".

    AWS gives records states: an owner proposes, the team reviews, and the outcome is accepted, reworked (still proposed) or rejected, with the reason written down "to prevent future discussions on the same topic". When a new record is accepted, the old one is marked superseded.

    stateDiagram-v2 accTitle: Life of a front-end decision record accDescr: A record starts as proposed. Review can keep it proposed for rework, reject it with a recorded reason, or accept it. An accepted record is later marked superseded when a new accepted record replaces it. Records are never edited after acceptance. [*] --> Proposed Proposed --> Proposed: rework after review Proposed --> Rejected: reason recorded Proposed --> Accepted: team approves Accepted --> Superseded: new record accepted Rejected --> [*] Superseded --> [*]

    Figure 3. States of a record. How to read this: accepted records have no arrow back to proposed. The only way out of accepted is to be superseded, so the log keeps the history of the thinking.

    A map: C4 for a front end

    The back-end lesson covers the four C4 levels. Two points apply directly to front ends.

    First, a container "represents an application or a data store", "essentially a runtime boundary around some code that is being executed or some data that is being stored", and the page opens with "Not Docker!". Its examples include a single-page application and a serverless function. A browser application is therefore a container. A feature module or a package is not: it organises code inside one.

    Second, the site recommends a system context diagram for all teams, aimed at "everybody, both technical and non-technical people". For a front end, the container view is where the interesting arrows live: what the browser talks to, and where a cache sits between.

    Storefront containers (illustrative)Storefront app to Static host and CDN (HTML, JS, CSS); Storefront app to Front-end API layer (HTTPS JSON); Front-end API layer to Catalogue service (reads); Front-end API layer to Orders service (places order)STOREFRONT (SOFTWARE SYSTEM)Storefront app: runs in browserStorefront appruns in browserStatic host and CDN: pages, assetsStatic hostand CDNpages, assetsFront-end API layer: per-screen dataFront-end APIlayerper-screen dataCatalogue service: productsCatalogueserviceproductsOrders service: checkoutOrders servicecheckoutHTML, JS, CSSHTTPS JSONreadsplaces order

    Figure 4. A container view of the storefront (illustrative). How to read this: the zone is the system the front-end team owns; the two grey boxes belong to other teams. Put the record number on the element it explains, for example "see ADR 7" on the API layer.

    The c4model.com notation page says a diagram should be able to stand alone, "(mostly) understood without a narrative". Title it, label every line, and say what each box is.

    Documentation beyond ADRs: four kinds, four jobs

    ADRs and diagrams are two documents. A front end also needs install steps, component guides and an overview. The Diataxis framework sorts documentation by need, and gives four forms: tutorials, how-to guides, reference and explanation. Its definitions: a tutorial "takes a student by the hand through a learning experience"; a how-to guide "addresses a real-world goal or problem"; reference holds "the technical description - facts - that a user needs in order to do things correctly"; explanation provides "context and background".

    Diataxis form Front-end example Mistake to avoid
    Tutorial "Build your first feature in this codebase" Turning it into a reference list
    How-to guide "Add a route", "Release a hotfix" Mixing in the history of why
    Reference Component props, design tokens, environment variables Opinions in the middle of a table
    Explanation The architecture overview, the ADR log, the C4 diagrams Step-by-step instructions

    ADRs and C4 diagrams belong with explanation: they answer "why" and "what is where". A neighbour is the design doc. The Google design-doc article says it achieves "consensus around a design" and has a non-goals section ("things that could reasonably be goals, but are explicitly chosen not to be goals") and an alternatives section its author calls "one of the most important ones". A design doc argues for a whole design before it is built; an ADR freezes one decision after the argument.

    Trade-offs

    Approach Gain Cost Wrong when
    Y-statement only Seconds to write, easy to scan Little room for options The decision needs a real argument
    Short Nygard record Context and consequences stay together Alternatives are optional The team keeps reopening rejected options
    Full MADR with confirmation Options and the check are explicit Longer, so it may be skipped Decisions are small and frequent
    Check in CI per record Rules enforce themselves Checks need upkeep, can be noisy The rule is a judgement call a tool cannot make
    Container diagram only Cheap, shows runtime boundaries Hides what is inside the app A module's inside is the question

    Failure example: the greeting that broke the cache

    Illustrative. A storefront generates product pages ahead of time so a CDN can serve them; the decision was agreed in a meeting and never written down. A newcomer adds "Welcome back, Sam" to the header, rendered per user on the server. Every test passes, because each checks that the greeting appears. The cacheable page has become a per-user page, and first paint slows for everyone. A record with a confirmation test, that generated product pages carry no per-user content, would have failed the pull request.

    In practice: recording where the cart lives

    This is an educational scenario on a storefront like the one in the e-commerce front-end case study; the name and numbers are illustrative.

    This is a realistic scenario, not a case history.

    The situation

    A team of six maintains a storefront. Cart state is held in a global store, in the URL for the checkout step and in a copy kept for offline use. Two new engineers join. One proposes deleting the offline copy as duplicate state, another proposes moving everything to the URL. Neither knows the history.

    Starting architecture

    One overview diagram, a year old, shows the browser app and two services but no state ownership. The reasons live in an old chat thread.

    Options considered

    Option Gain Cost Wrong when
    A. One store owns the cart; other copies are read-only projections One source of truth Projections must be rebuilt after sync Offline writes must merge independently
    B. The URL owns the cart Shareable, survives reload Long URLs, privacy of cart contents in logs The cart holds private data

    The decision

    The team writes record 7 in the short Nygard form, with a stated confidence of medium and a confirmation line. The context names the constraints: the offline requirement and the privacy of cart contents. It picks option A.

    # 7. One store owns the cart
    
    Status: accepted
    
    ## Context
    The cart is read by the header, the cart page and checkout, and must
    survive a reload and a lost connection. Cart contents are private.
    
    ## Decision
    We will keep one cart store as the owner. The offline copy and the
    checkout step are derived from it and never written independently.
    
    ## Consequences
    Derived copies must be rebuilt after sync. Any code that writes the
    cart outside the store is a defect. Confidence: medium. Revisit if
    offline edits need to merge from several devices.
    
    ## Confirmation
    A lint rule forbids importing the cart storage module outside the
    store. The failure message links this record.

    Rollout and verification

    The record and the lint rule land in one pull request, with the diagram updated to say "see ADR 7". A new engineer is asked to explain, from the diagram and record alone, why the offline copy exists. If they cannot, the record is rewritten.

    The 2 a.m. failure

    The cart badge shows 3 items while the cart page shows 2. A recent change writes the offline copy directly from a sync handler, bypassing the store; the lint rule did not run because that path was excluded. Mitigation: roll back. Follow-up: fix the lint scope, add a test that fails when the two disagree after a sync, and note the gap in a new record that supersedes record 7.

    Architect's notes

    • Record at the moment of decision, while the rejected options are fresh.
    • Always write the downside. The "accepting" clause is what later engineers need most.
    • Attach a check where you can. A rule enforced by a tool outlives the people who remember it.
    • Keep records short, "pithy, assertive, on-topic, and factual" in Azure's words; link long design material instead of copying it.

    Common mistakes

    • Recording what was built instead of why. AWS says the value of the format is the reason for the decision.
    • Editing accepted records to match what the code became, which erases the evidence.
    • A context with no client constraints. Without the browser, device and budget conditions, the record reads as preference.
    • Reading "container" as Docker. In C4 a single-page application is one.

    Key takeaways

    • An ADR holds one architecturally significant decision and its rationale; the set is the decision log.
    • Record front-end decisions that shape structure or key qualities, or that are hard to undo.
    • Name client constraints in the context, and write the downside.
    • Use MADR's confirmation idea: tie records to checks that fail the build.
    • Accepted records are superseded, never edited.
    • A browser application is a C4 container; draw context and container views first.
    • Sort other documents into tutorial, how-to, reference and explanation.

    Practice exercises

    Exercise 1 (20 min). Write a Y-statement for the rendering strategy of one page in an app you know. If the "accepting" clause is empty, find the downside.

    Exercise 2 (40 min). Pick three decisions from the table above and write a confirmation check for each. For one, explain why no tool can check it.

    Exercise 3 (45 min). Draw the context and container views of a front end you know. Give them to someone new and note what they ask.

    Official documentation

    Ask about this article

    Get answers grounded in this post. AI-generated — based on this article, and may be imperfect.

    Scaled AI Weekly

    Enjoyed this? Get more like it every Monday.

    Real architecture decisions, LLMOps patterns that survive production, and engineering leadership advice — from 12+ years of building at enterprise scale. Free. No spam. Unsubscribe anytime.

    Get new articles by email

    Free. We email a confirmation link first, and you can unsubscribe from any email.

    Join engineers building production AI systems

    Comments