What you'll learn: By the end of this lesson you will be able to write a front-end design doc from a template, state goals and non-goals so that each one can be checked, record a decision with its alternatives and the condition that would reverse it, cover the cross-cutting concerns a front end tends to forget (accessibility, performance, failure states, observability), and write the audit plan before the build so the later review can contradict the doc.
A builder does not start with bricks. They draw the plan, mark what the building will not include (no lift, no basement), and write down why the walls are where they are, so a plumber can later tell which wall is safe to move. A design doc is that plan for software. The capstone asks you to make one for a complete front end before you build it, and to write it so that someone else can check your work against it.
The capstone brief and requirements (a separate lesson in this module) set the scope. This lesson turns that scope into a design. The next one, on the build, audit and review, tests the result against what you write here. The architecture decision record lesson of this module goes deeper on single records.
Sources: "Design Docs at Google", Michael Nygard's "Documenting Architecture Decisions", the WCAG-EM methodology, WCAG 2.2 conformance, web.dev Web Vitals and performance budgets. All read on 2026-12-02.
The core idea
A design doc is a record of decisions and trade-offs written while changing course is still cheap. Its value is that someone can later point at a sentence and say "this was promised, and here is what happened".
Three illustrations run through the lesson:
- Minimal example: one decision written as a table with its alternatives and its reversal condition.
- Realistic example: the skeleton of a design doc for an order dashboard, the front end of a grocery marketplace (the ShopStream front end). Replace it with your own project.
- Failure example: a doc that lists a goal nobody can check, and the audit that therefore cannot fail it.
What a design doc is for
"Design Docs at Google" gives the functions of a design doc: early identification of design issues while changes are still cheap, building consensus before coding, covering cross-cutting concerns that might otherwise be missed, and spreading senior engineers' knowledge. It suggests that for a larger project around 10 to 20 pages is a sweet spot and that a short "mini design doc" of one to three pages suits smaller incremental work. It warns against docs that are really implementation manuals.
For a capstone, aim at the small end: a few pages a reviewer can read in one sitting. The test of a doc is whether a reader can find, for any part of the system, the sentence that explains why it is that way.
The template
The article lists a structure that "has proven useful": context and scope, goals and non-goals, the design, alternatives considered and cross-cutting concerns. The capstone version keeps those and adds two sections that a front end needs, an audit plan and a results section.
# Design doc: <project name>
1. Context and scope what exists today, what this builds, link to the brief
2. Goals and non-goals checkable goals; non-goals with a reason each
3. Requirements functional, then non-functional with numbers
4. Design overview system-context figure, data flow, where state lives
5. Decisions one table per decision: options, choice, cost, reversal
6. Cross-cutting concerns accessibility, performance, failure states, observability, security
7. Audit plan each goal -> the measurement that will judge it, written first
8. Risks and open questions what could be wrong and who finds out
9. Results filled in after the audit; allowed to say the design was wrong
Figure 1. The doc sits between the brief and the audit
How to read this: the doc is the middle of the capstone, not its first page. The audit does not grade the code in a vacuum; it measures the code against the plan in the doc, and the results go back into the same document.
Context, goals and non-goals
Context and scope. The article says this section "should be entirely focused on objective background facts": what exists, what the project builds, and how it relates to the brief. It is not a place for requirements or opinions.
Goals say what the system should achieve. A goal earns its place only if you can name how it would be judged. "Fast" is a wish. "LCP of 2.5 seconds or less at the 75th percentile" is a goal: web.dev says a page should hit the "good" value of LCP within 2.5 seconds, INP of 200 milliseconds or less and CLS of 0.1 or less, and that a good threshold to measure is the 75th percentile of page loads, segmented across mobile and desktop.
Non-goals are, in the article's words, "things that could reasonably be goals, but are explicitly chosen not to be goals". They are not the opposite of goals ("the page should not be slow"). For the order dashboard, a real non-goal is "no offline editing in version 1", because someone could sensibly ask for it. Give each non-goal a one-line reason; it tells the reviewer what not to fault.
Illustration 1: the minimal example
One decision as it would appear in section 5. The numbers are illustrative.
| Option | Gain | Cost | Choose when |
|---|---|---|---|
| Client-side rendering only | Simplest to build and host | Slow first paint on weak devices; content needs scripts | The app is behind a login and not indexed |
| Server rendering of the shell and the first list | Faster first paint of the list | A server to run; hydration to get right | First paint matters and data is cheap to fetch on the server |
| Static prerendering | Cheapest to serve | Data is as old as the last build | The data barely changes |
Choice: server-render the shell and the first page of orders; render the rest on the client. Cost accepted: a server tier and a hydration step to test. Reverse when: the audit shows server time dominating LCP, or the hosting cost exceeds the budget in section 3. The rendering strategies lesson covers the options in depth; the doc only records your choice.
A decision with a reversal condition can be revisited without an argument. Nygard's article on decision records says a record has a title, context, decision, status and consequences, that it should be one or two pages, and that a reversed decision is kept and marked superseded.
Figure 2. The life of a decision record
How to read this: records are not deleted when plans change. The old one stays, marked, so a later reader can see what was believed and when. "Proposed", "accepted", "deprecated" and "superseded" come from Nygard's article; "rejected" is this lesson's addition.
Requirements with numbers
Section 3 separates what the system does (functional) from how well it must do it (non-functional). The second list is the one audits judge, so every item needs a number or a yes/no test. For the order dashboard:
| Kind | Requirement | How it is judged |
|---|---|---|
| Performance | LCP, INP, CLS at the 75th percentile within the published "good" values | Field or lab measurement per route |
| Performance | JavaScript on the main route under a budget you choose (illustrative: 170 KB gzip) | Build output |
| Accessibility | No automated violations; every key flow done by keyboard alone | Tool run plus a manual pass |
| Resilience | Loading, empty, error and refresh-failed states exist for every remote list | Checklist of screens |
| Testing | No failing tests; the critical flows have at least one end-to-end test | Test run |
A performance budget is, per web.dev, "a set of limits imposed on metrics that affect site performance", which can be quantity-based (page weight, request count, script size), milestone timings or rule-based scores. See performance budgets and profiling and Core Web Vitals.
The design overview
Section 4 shows the system once, as one figure, and says where state lives. Keep it to what the audit will touch.
Illustration 2: the realistic example
The order dashboard is a single-page front end for staff of a grocery marketplace. It shows an order list with search and a status filter, a detail page and a "mark as packed" action, and talks to one backend-for-frontend (BFF) service in front of the orders API. Staff sign in through an identity provider. All numbers here are illustrative.
Figure 3. Context of the order dashboard
How to read this: the accent box is what the capstone builds; grey boxes are outside it.
State goes in the same section: server data in a cache keyed by query (see server state, caching and revalidation), the filter and search in the URL, and a draft of an in-progress action in the component. For each piece of state write one line: where it lives, who may change it, and what happens on reload.
Cross-cutting concerns
The article gives "security, privacy, and observability" as examples and says teams decide which apply. For a front end, five nearly always do:
- Accessibility. State the target. WCAG 2.2 defines three levels: A is the minimum, AA needs every A and AA criterion, and AAA adds the AAA ones. The same page says AAA is not recommended as a general policy for entire sites. A capstone usually targets AA. Conformance applies to full pages and complete processes: every page in a multi-step flow must conform at the claimed level. See accessibility fundamentals and WCAG.
- Performance. The budget from section 3, and which route it applies to.
- Failure states. The states of every remote list (loading, empty, error, refresh failed). The error, loading and empty states lesson gives the model.
- Observability. What you will measure in the field and how it reaches you (real user monitoring).
- Security and privacy. Where the token is kept, what is logged, what the CSP allows.
One sentence each is enough, if each has an owner and a way to be checked.
The audit plan comes first
Section 7 is a table with one row per goal: the goal, the measurement, the tool, who runs it, and the pass line. Write it before the build: criteria written after the results are measured tend to fit the results.
For accessibility, the W3C's WCAG-EM methodology shows how a real evaluation is planned: define the scope, explore the target, select a representative sample, evaluate it, report. It says the structured sample should include common views and essential functionality, and that a random sample of 10 percent of the structured set is added to check that the structured set missed nothing. It also says that conformance claims for a whole website cannot be made from a sample alone. For a six-page capstone, check all six and claim only what you checked.
W3C guidance on evaluation tools adds that tools "can not determine accessibility, they can only assist", so the plan lists manual steps (a keyboard walk of each key flow) next to the tool run.
Figure 4. From goal to evidence
measurement?"} M -- yes --> T["Tool or manual step
and pass line"] M -- no --> R["Rewrite the goal
or make it a non-goal"] T --> P["Row in the audit plan"] R --> G
How to read this: the diamond is the whole discipline. A goal with no way to be judged does not enter the plan; it is rewritten until it can be, or it moves to the non-goals.
Illustration 3: a failure
An illustrative case. A doc lists the goal "The dashboard should feel responsive and accessible", and the audit plan says "check with Lighthouse". The run shows a green score and the project is declared done, although a keyboard-only user cannot reach the "mark as packed" button. No sentence in the doc was wrong, because no sentence could be. Lighthouse's performance score is a weighted average of metric scores, and only metrics contribute to it; it says nothing about keyboard reachability. The fix: rewrite the goal as "every key flow completes by keyboard alone, and no automated violations", with a manual step per flow.
Trade-offs
| Choice | Gain | Cost |
|---|---|---|
| Short doc with decision tables | Read in one sitting; easy to keep current | Detail lives in code and records |
| Audit plan before the build | Honest criteria | Some criteria turn out wrong and must be revised, with a note |
| Targeting AA | A recognised target | More to check than a basic scan |
| One record per decision | Easy to supersede | More files to keep tidy |
Build it
This lesson has no lab: the deliverable is a document. Use the template above as the starting point and fill in the skeleton for your own capstone. A minimal skeleton, as it would start, with the order dashboard as the example:
# Design doc: Order dashboard
1. Context and scope: staff packing tool for a grocery marketplace; builds the front end only.
2. Goals: G1 LCP at p75 within the published good value. G2 every key flow completes by keyboard alone.
Non-goals: N1 no offline editing in v1 (reason: sync conflicts are out of scope).
3. Requirements: JavaScript on the main route under the budget in section 3 (illustrative: 170 KB gzip).
4. Design overview: Figure 3; server data cached by query; filter in the URL.
5. Decisions: D1 render the shell on the server (table, reversal: server time dominates LCP).
6. Cross-cutting: AA target; states per list; field vitals reported; token kept in memory.
7. Audit plan: G1 -> lab run per route and field data; G2 -> keyboard walk of 3 flows.
8. Risks: hydration mismatches; the tablet keyboard flow is untested.
9. Results: (empty until the audit).
The next lesson has a small pure-TypeScript lab that scores a checklist like section 7.
In practice: the doc for the order dashboard
This is a realistic scenario, not a case history. It is a composite built from common team practice. It describes no specific company or product, and every number in it is an illustrative assumption.
The situation
A three-person team starts the order dashboard. Two want to begin coding on day one. The third asks for a two-page doc first. Nobody is sure whether the first release must work on tablets, and the packing manager's wish list has 14 items.
Starting architecture
Figure 5. Before the doc
How to read this: the warning boxes are where the project loses information. Scope lives in chat, and the review has nothing written to hold the build against.
Options considered
| Option | Fixes | Costs | Risk |
|---|---|---|---|
| Code first, doc at the end | No delay | The doc describes what happened | Criteria fit the results |
| A short design doc from the template | Goals, non-goals, plan | About a day of writing | Over-detail |
The decision
| Field | Decision record |
|---|---|
| Context | Scope is in chat; tablets are undecided; 14 wishes. |
| Decision | Write a short doc using the template. Cut the wish list to 5 goals and 3 non-goals with reasons. Write the audit plan before the first commit. |
| Consequences, good | The review checks the build against written goals; arguments move to the decision tables. |
| Consequences, bad | A day of writing; some goals are later revised. |
| Revisit when | The audit shows a goal that cannot be measured, or the scope changes. |
Rollout and verification
- Draft sections 1 to 3 and agree the goals and non-goals with the packing manager.
- Write sections 4 to 7; ask someone outside the team to find a goal with no measurement.
- Build. When a decision changes, add a record and mark the old one superseded.
- Run the audit from the plan and fill in section 9, including what did not work.
The 2 a.m. failure
The doc says the token is kept in memory, but a later change stored it in local storage for convenience, and nobody updated the doc. A security review at 2 a.m. after an alert finds the mismatch.
First three checks: (1) compare the cross-cutting section with the code; (2) look for records marked accepted whose reversal condition has occurred; (3) check whether the change had a record. Mitigation: revert the change or write the record and accept the new risk. Follow-up: add the token location to the audit plan as a check, so a mismatch is found by a test and not by an incident.
Architect's notes
- Numbers in the doc, not in your head. If a number matters, it appears with its unit and a source or the word illustrative.
- Say what you did not choose. The alternatives table is the most useful part of the doc.
Common mistakes
- Goals that cannot be judged, such as "fast", "clean", "accessible".
- An audit plan written after the results.
- Decisions without alternatives or a reversal condition.
- Claiming conformance for pages you did not check.
Key takeaways
- A design doc records decisions and trade-offs while changing course is cheap.
- Goals need a measurement; non-goals are reasonable goals you chose not to pursue, each with a reason.
- Record each decision with options, cost and a reversal condition; mark reversed records superseded.
- Cover accessibility, performance, failure states, observability and security explicitly.
- Write the audit plan first, including manual steps, because tools assist and do not determine accessibility.
Practice exercises
Exercise 1: Starter (30 min). Rewrite three vague goals so each has a measurement and a pass line.
Exercise 2: Intermediate (2 hours). Write sections 1 to 3 and the audit plan (section 7) for your own capstone. Ask a colleague to find one goal with no measurement.
Exercise 3: Advanced (half day). Write three decision records for your capstone with at least two alternatives each and a reversal condition. Then change one decision on purpose and mark the first record superseded.
Related reading
In this course:
- Requirements and Constraints: turning a brief into numbers.
- Rendering Strategies: the options behind the decision table.
- Performance Budgets and Profiling: enforcing the budget.
- Accessibility Fundamentals and WCAG: levels and what conformance covers.
- Backend capstone: design doc, load test and failure injection: the same discipline on the server.
Official documentation
- Design Docs at Google: the structure and purpose of design docs.
- Documenting Architecture Decisions (Michael Nygard): the decision record format.
- W3C: WCAG-EM: evaluation steps and sampling.
- W3C: Understanding Conformance (WCAG 2.2): levels and conformance requirements.
- web.dev: Web Vitals: the "good" values and the 75th percentile.
- web.dev: Performance budgets 101: what a budget contains.