0% completed
Requirements for a Frontend Design
On This Page
Two Kinds of Requirement
Functional Requirements as Actions on Screens
Non-Functional Requirements in Numbers
How a Number Becomes a Decision
Promises Left Out
Using This in an Interview
Key Takeaways
Practice Questions
Basket makes four promises to the people who shop on it:
- A shopper can find any of the 4,000 products from the search box, with suggestions while typing.
- The first products on the list appear within 2.5 seconds on a mid-range phone with a slow mobile connection.
- The cart keeps its items when the connection drops, and still has them the next day.
- The order tracking page shows where the courier is, at most 10 seconds out of date.
It also makes three non-promises. Checkout does not work without a connection. The store is not offered in right-to-left languages such as Arabic. Browsers that make up a tiny share of visits are not tested.
Each line in both lists is a requirement, and the second list matters as much as the first. The sections below explain how to write the two kinds of frontend requirement, why each needs a number, and how a number turns into a design decision.
Two Kinds of Requirement
A functional requirement says what a user can do. "A shopper can add a product to the cart from the product list" is one.
A non-functional requirement says how well the product must do it: how fast, on which devices, for which users, in which languages, and how safely. "The tap on Add to cart responds within 200 ms" is one.
A design needs both. The functional list decides which screens and parts exist. The non-functional list decides how each part is built, and it is the list that separates a frontend design from a list of features.
Functional Requirements as Actions on Screens
A frontend requirement is easiest to check when it names a user, an action, a screen and a visible result. "The shopper types two letters in the search box and sees up to 8 suggestions" can be tested. "Good search" cannot.
Look at how each badge sits on a part of the screen. Every functional requirement points at something the shopper can see and touch, which is why the list of requirements also becomes the first list of components.
Here are Basket's core actions, screen by screen:
| Screen | The shopper can |
|---|---|
| Product list | Browse 4,000 products 30 at a time, filter by category and diet, sort by price |
| Search | Type a query, pick a suggestion, see matching products |
| Product page | See photos, price, stock and nutrition facts, and add the product to the cart |
| Cart and checkout | Change quantities, choose a delivery slot, pay, place the order |
| Order tracking | See the order's status and the courier's position on a map |
| Account | See past orders and buy a past order again |
The list also records what is out of scope. Writing reviews, recipes and the staff tools that manage the catalog are not part of this design. Saying so early keeps the team from spending time on screens nobody asked for.
Non-Functional Requirements in Numbers
A non-functional requirement without a number cannot be checked. "Fast on phones" leaves open which phone, which network, and how fast. The table below gives each of Basket's quality requirements a number or a named standard, and shows which part of the design it decides.
| Area | Basket's requirement | What it decides |
|---|---|---|
| Devices and networks | A mid-range phone with a processor about 4 times slower than a desktop's, on the slow mobile profile (150 ms round trip, 1.6 Mbps); screens from 360 to 2,560 pixels wide | How many bytes and how much JavaScript each page can afford; the layouts |
| Performance | LCP within 2.5 s, INP within 200 ms, CLS at most 0.1 | Where rendering happens, how much code runs on each tap |
| Supported browsers | The current and previous major versions of Chrome, Edge, Firefox and Safari | Which browser features need a fallback |
| Accessibility | WCAG 2.2 at level AA | Keyboard paths, labels, focus, color contrast |
| Languages | English and Spanish, prices and dates in each locale's format, no right-to-left | How text and number formats are stored and loaded |
| Offline | Cart readable and editable without a connection; checkout needs one | What the browser stores, how changes are sent later |
| Search engines | Home, category and product pages readable from the HTML; cart, checkout and account never indexed | Server-produced HTML for public pages |
| Security | Card numbers never reach Basket's own code; no outside scripts on checkout except the payment provider's | A payment provider's frame for card fields, script rules per page |
| Freshness | Order status at most 10 seconds old; prices current at each page load | Whether the page needs a live connection |
Three of those rows use names that need a short explanation. LCP (Largest Contentful Paint) is the time until the largest image or block of text in the visible part of the screen appears. INP (Interaction to Next Paint) is how long the page takes to show a visible response after a tap, click or key press, and its value for a visit is one of the slowest of those responses. CLS (Cumulative Layout Shift) is a score for how much visible content moves unexpectedly while the page is open, not only while it loads.
WCAG (Web Content Accessibility Guidelines) is the standard from the W3C for making web content usable by people with disabilities, and level AA is the level that most accessibility laws and company policies refer to. Search engine optimization, or SEO, is the work of making pages readable and well ranked by search engines.
How a Number Becomes a Decision
A requirement with a number can rule a design out before any code is written. The LCP target is a good example.
Frontend System Design vs Backend System Design showed that opening a connection and downloading the HTML take about 700 ms on the slow profile. That leaves 1.8 seconds of the 2.5 second LCP target. If the product list can appear only after a 400 KB bundle downloads, the download alone takes about 2,150 ms, so the target is missed before the code even starts running. The requirement therefore rules out that design, and it points toward sending the first products inside the HTML.
Notice that two requirements point at the same area. Both the LCP target and the search engine requirement decide how product pages are rendered, and they agree, which makes the choice easier to defend.
The other numbers work the same way. An INP target of 200 ms on a phone 4 times slower than a desktop means that code taking 60 ms on a desktop takes about 240 ms on the phone, which already misses the target. The 10 second freshness limit for order status rules out asking the server once a minute, and it allows either a check every few seconds or a live connection.
The browser list decides how much extra code ships. If every supported browser already has a feature, the page can use it directly. If one browser in the list lacks it, the team must either send extra code that adds the feature to that browser or build a simpler path for it, and both choices cost bytes or time. The security row works the same way: "card numbers never reach Basket's code" decides that the card fields come from the payment provider, inside a frame that Basket's scripts cannot read.
Promises Left Out
A non-promise removes work, and it also records a choice that others can question early. "No right-to-left languages" means Basket does not mirror its layouts. "Checkout needs a connection" means the design does not have to handle two payments made offline for the same cart.
Each non-promise is also a risk to name. If the business later adds Arabic, every layout that uses "left" and "right" in its styles has to change. Writing the non-promise down makes that cost visible on the day it is chosen, not on the day it is reversed.
Using This in an Interview
Before drawing anything, state your numbers as assumptions and ask for corrections: "I will assume a mid-range phone on a slow mobile network, LCP within 2.5 seconds, INP within 200 ms, WCAG AA, and two languages. Product pages must be readable by search engines, and checkout works only online."
Two follow-up questions are likely:
- "What changes if the store must also work in Arabic?"
- "Which requirement would you drop first if the team had half the time?"
Key Takeaways
- A functional requirement says what a user can do; a non-functional requirement says how well, on what, and for whom.
- Write functional requirements as a user, an action, a screen and a visible result, so that each one can be tested.
- Give every non-functional requirement a number or a named standard: target device and network, LCP, INP and CLS targets, browsers, WCAG level, languages, offline needs, search engines and security.
- A numbered requirement can rule a design out by arithmetic alone, such as a 2.5 second target that a 2,150 ms download already misses.
- Non-promises remove work and record choices, so write them down with the promises.
With the requirements written in numbers, the next step is to check whether a design can meet them. The next lesson, Estimating Bytes Frames and Requests, shows how to work out those numbers for a page before it is built.
Practice Questions
Try each question first, then open the answer.
1. A product manager writes "Search should feel fast." Rewrite it as one or two requirements that a test could check.
<details> <summary>Show answer</summary>Name the device, the action and the time. For example: "On a mid-range phone on the slow mobile profile, each key press in the search box shows a visible response within 200 ms." And: "Suggestions appear within 500 ms after the shopper stops typing, when the network is working." Both can now be measured and pass or fail.
</details>2. A teammate proposes drawing the product page entirely in the browser, after the whole 400 KB bundle has loaded. Which two of Basket's requirements argue against it?
<details> <summary>Show answer</summary>The LCP target of 2.5 seconds and the search engine requirement. On the slow profile, the connection and HTML take about 700 ms and the bundle download about 2,150 ms, so the product cannot appear before about 2.85 seconds. The search engine requirement also asks for the product name and price in the HTML, which a page drawn only in the browser does not contain.
</details>3. A stakeholder says, "Basket should work offline." What do you need to ask before this becomes a requirement?
<details> <summary>Show answer</summary>Ask which actions, on which screens, and what happens when the connection returns. Reading the cart offline is very different from placing an order offline. You also need to know how old the offline data may be, for example yesterday's prices, and what the shopper sees when a change made offline is refused later. Basket's answer is that the cart works offline and checkout does not.
</details>4. Basket's requirements say "no right-to-left languages." What work does this remove, and what risk does it create?
<details> <summary>Show answer</summary>It removes mirroring every layout, and it risks a large change if Arabic or Hebrew is added later. Without the requirement, the team must lay out every screen so that it can flip direction. With it, styles may use fixed left and right positions, and each of those must be rewritten if the business changes its mind. Writing the non-promise down makes that cost visible early.
</details>5. Is each of these functional or non-functional? (a) A shopper can buy a past order again from the account page. (b) The account page can be used with a keyboard alone. (c) Order status is at most 10 seconds old.
<details> <summary>Show answer</summary>(a) Functional, (b) and (c) non-functional. The first says what the shopper can do. The second says how well the page must work for keyboard users, an accessibility requirement. The third says how fresh the data must be. It belongs to the tracking feature, but it describes quality, not a new action.
</details>Reading Progress
0%
On This Page
Two Kinds of Requirement
Functional Requirements as Actions on Screens
Non-Functional Requirements in Numbers
How a Number Becomes a Decision
Promises Left Out
Using This in an Interview
Key Takeaways
Practice Questions