Skip to content
FrontDepth, Home

Frontend System Design

Approaching a frontend system design interview

How to run a frontend system design round in five stages, from clarifying requirements and drawing the client architecture to the data model, component and network APIs, optimizations, trade-offs and time management.

MiddleSeniorUpdated 16 November 2026

Reading level

Shows sections up to the selected level.

Before you start

No prerequisites.

This topic starts at Middle level.

MiddleConcept

What the round tests and how it differs from backend design

In a frontend system design round you design a product or a component from the browser's side: what the user sees, how the client is structured, how data travels from the API to the pixels, and how the result stays fast, accessible and robust on real devices. The server is mostly a black box: you define the API contract the UI needs, but nobody expects database sharding.

Frontend roundBackend round
FocusClient architecture, components, state, rendering, network contractServices, storage, scaling, consistency
"Scale" meansData on one screen, slow devices and networks, bundle size, many tabsRequests per second, data volume, replicas
You deliverA component tree, state ownership, API shapes, a performance and accessibility planA service diagram, schemas, capacity estimates

Questions come in two kinds. Application questions (a news feed, a chat app, a checkout) are broad: architecture and data flow matter most. Component questions (an autocomplete, an image carousel, a video player) are narrow and go deep into the component API, states, keyboard and screen reader support.

Five stages

The platform's System Design Board walks every problem through the same five stages, an order that is widely known as the RADIO framework:

  1. Requirements: what to build, for whom, how well, and what is out of scope.
  2. Architecture: the client's parts and how they talk to the server.
  3. Data model: entities, and where each piece of state lives.
  4. Interface: component APIs and the network API.
  5. Optimizations: performance, accessibility, i18n, offline, security.

The stages are a checklist, not a script. When the interface shows that the data model is missing a field, go back and fix it, and say so out loud.

A time plan for 45 minutes

MinutesStageWhat is on the board at the end
0-5RequirementsFunctional and non-functional requirements, assumptions
5-15ArchitectureThe client diagram and its server touch points
15-22Data modelEntities, client vs server state, cache keys
22-32InterfaceMain components with props, endpoints with shapes
32-42OptimizationsTwo or three deep dives that matter for this product
42-45Wrap-upRecap, open risks, your questions

For 60 minutes, give the extra time to the interface and the deep dives. If you are behind, say what you would cover next and move on; an unfinished diagram with a clear plan scores better than a perfect requirements list and nothing else.

MiddleConcept

Stage 1: Requirements

The brief is vague on purpose. The first five minutes show whether you build the right thing, so ask before you draw, then write the answers down where the interviewer can see them.

Functional requirements: what users can do. List the core flows and agree on what is out of scope ("no editing of sent messages").

Non-functional requirements: how well. Performance targets, devices (phones, low-end Android), browsers, network quality, offline use, accessibility, languages and right-to-left scripts, SEO, privacy.

Users and scale: how many items on a screen, how often data changes, how many people act on the same data at once. In a frontend round, scale means "10,000 rows in a table" or "200 messages a minute in one chat", not servers.

Constraints: does the API exist or do you design it, which framework and design system are in place, is the page public or behind a login.

Example: autocomplete

Functional

  • Suggestions appear while the user types, from 2 characters.
  • Arrow keys move through suggestions, Enter selects, Escape closes.
  • A suggestion shows a title and a category; selecting one opens the product.

Non-functional

  • Suggestions within about 200 ms after the user pauses typing.
  • Works on phones and with screen readers.
  • Interface in Azerbaijani and English.

Assumptions

  • A search endpoint exists; I define its contract.
  • At most 10 suggestions, no paging inside the dropdown.
  • Recent searches are kept per device, not per account.

Assumptions are part of the answer

When the interviewer says "up to you", decide, write the assumption down, and add one sentence on what would change if it were different: "I assume no offline support; if we needed it, the search cache would move into IndexedDB." This keeps the design moving and shows you saw the alternative.

Finish the stage by naming your priorities: "I'll focus on typing latency and keyboard access, and cover analytics briefly at the end." It tells the interviewer where the deep dives will be and gives you a plan for the remaining time.

MiddleConcept

Stage 2: Architecture of the client

Draw boxes with one responsibility each, and arrows that show which way data flows. A typical client for a data-heavy app:

Text
CDN: HTML, JS, CSS, images
          |
Browser -----------------------------------------------------
  App shell + router                     Service worker
     |
  Route /feed (lazy chunk) -> component tree
     |                              |
  Client state store           Server-state cache
                                    |
                               API layer
                                    |
Server ------------------------------------------------------
  REST / GraphQL API (BFF)          Real-time gateway (WebSocket / SSE)

What each box is for:

  • App shell: the frame that renders first (header, navigation, layout, an error boundary) and the router. Each route is a separate chunk, so a visitor of /feed does not download the settings page.
  • Component tree: split into components that fetch or connect data and components that only render props. Say which component owns which state.
  • Server-state cache: data the server owns, kept on the client by request key, with deduplication, background refetch and invalidation. Libraries such as TanStack Query, SWR, Apollo Client or Relay do this; naming one is fine, explaining what it does matters more.
  • Client state store: state that exists only in the browser: a draft, the selected tab, whether a panel is open. Often small enough for component state or context.
  • API layer: one module that every request goes through. Base URL, auth, error normalization, retries and AbortController cancellation live here once, not in every component.
  • Service worker and CDN: static assets from the CDN with long cache lifetimes; a service worker only if offline use or background sync is a requirement.

Server touch points

Name each place where the client meets the server: the main API (a backend-for-frontend can shape responses for the screens), a real-time channel, an image CDN that resizes images, an auth endpoint, an analytics endpoint. You do not design them; you state what you need from each.

Data flow in one sentence

Say it explicitly: "Server data flows into the cache, components read it through hooks; user actions call mutations, which update the cache optimistically and invalidate the affected keys." That sentence answers half of the follow-up questions about consistency.

MiddleExample

Stage 3: Data model

Start from the screens: list what each one shows, and turn that into entities with fields. Then decide where every piece of state lives:

  • Server state: owned by the server, cached on the client: messages, users, products.
  • Client state: exists only in the browser: draft text, an open dialog, the highlighted suggestion.
  • URL state: what should survive a reload and be shareable: search query, filters, sort order, the selected item's id, the page.
  • Derived state: computed from the rest and never stored separately: a filtered list, a total price.

Example: chat-app

TypeScript
type User = { id: string; name: string; avatarUrl: string };

type Message = {
  id: string;
  clientId: string;
  chatId: string;
  authorId: string;
  text: string;
  sentAt: string;
  status: "sending" | "sent" | "failed";
};

type Chat = { id: string; title: string; memberIds: string[]; unreadCount: number };

type ChatStore = {
  users: Record<string, User>;
  messages: Record<string, Message>;
  messageIdsByChat: Record<string, string[]>;
  nextCursorByChat: Record<string, string | null>;
};

The store is normalized: each user and message is stored once, by id, and lists hold ids. A user who changes their avatar is updated in one place and every message shows the new one; nothing can show two versions of the same entity. The cost is a lookup when rendering (messageIds.map((id) => messages[id])), usually wrapped in a selector.

clientId and status exist because of the interface: a message is shown immediately with a temporary id and status: "sending", then matched with the server's copy by clientId when the confirmation arrives.

Cache keys

A server-state cache stores each response under a key, and the key must contain every input that changes the response:

JavaScript
["chats"]
["messages", chatId, { before: cursor }]
["search", { q: "laptop", locale: "az" }]

Keys decide three things: which components share one request (deduplication), what is refetched after a mutation (invalidate ["chats"] when a message arrives), and what can be reused (going back to a search shows the cached result at once). A missing input in the key, such as the locale, is a classic bug: the Azerbaijani page shows English results from the cache.

For a component question the data model is smaller but still worth stating: the autocomplete has query (client state, mirrored in the URL on a search page), suggestions (server state keyed by query) and activeIndex (client state).

MiddleExample

Stage 4: Interface: component API and network API

Component API

Describe the main components as a contract: props in, events out, which states they render (loading, empty, error, success), and whether they are controlled or uncontrolled. For a component question this is the core of the answer:

TSX
<Autocomplete
  label="Search products"
  minQueryLength={2}
  debounceMs={200}
  fetchSuggestions={(query, { signal }) => searchProducts(query, { signal })}
  renderItem={(item) => <ProductRow product={item} />}
  onSelect={(item) => openProduct(item.id)}
/>

Choices worth saying out loud: fetchSuggestions receives an AbortSignal, so a stale request can be cancelled; renderItem keeps the component reusable for other data; label is required because the input needs an accessible name. Mention the controlled option (value and onChange) for forms that own the query.

Network API

Write each endpoint with its method, parameters and response shape:

Text
GET /api/search?q=lap&limit=10
200 OK
{ "query": "lap", "items": [{ "id": "p1", "title": "Laptop stand", "category": "Desks" }] }

GET /api/feed?cursor=eyJpZCI6MTQzfQ&limit=20
200 OK
{ "items": [{ "id": "143", "text": "..." }], "nextCursor": "eyJpZCI6MTIzfQ" }

REST or GraphQL. REST is simple, and GET responses can be cached by URL in the browser and on a CDN. GraphQL lets the client ask for exactly the fields a screen needs and fetch nested data in one round trip, with a typed schema; the costs are more client tooling and the fact that POST queries are not cached by HTTP caches (persisted queries over GET help). Pick one and say why; both are acceptable answers.

Pagination.

  • Offset (?offset=40&limit=20): easy, and you can jump to page 7. But when new items are inserted at the top, every page shifts: the user sees duplicates or misses items. Deep offsets are also slow for many databases.
  • Cursor (?cursor=...): the server returns an opaque pointer to the last item. Pages stay stable while data changes, and the query stays fast. You cannot jump to page 7.
  • Infinite feeds and chats use cursors; admin tables with page numbers often use offsets.

Also name the error contract: status codes, a machine-readable error code, and which errors the UI shows inline (validation) versus as a retryable banner (network).

SeniorWeb platform

Real-time updates, optimistic updates and failures

Getting updates from the server

Short pollingServer-Sent EventsWebSocket
DirectionClient asks every N secondsServer to clientBoth ways
TransportPlain HTTP requestsOne long HTTP response (EventSource)Upgraded connection, own framing
ReconnectionNothing to reconnectAutomatic; Last-Event-ID lets the server resumeYours to write: backoff, heartbeats, resync
FitsDashboards refreshed every 30-60 sFeeds, notifications, live scoresChat, presence, collaborative editing

Polling is the honest default when a delay of a minute is fine, as in the analytics-dashboard problem. SSE is plain HTTP and reconnects on its own, but it carries text only, and over HTTP/1.x a browser allows only 6 open connections per domain across all tabs, so it needs HTTP/2 or one shared connection. WebSocket is the answer for two-way traffic (chat-app, collaborative-editor), and the follow-up is always "what happens when it drops?": reconnect with backoff, then fetch what was missed since the last known message id.

Optimistic updates

Show the result before the server confirms, and keep what you need to undo it:

JavaScript
async function toggleLike(post) {
  const previous = cache.get(post.id);
  cache.set(post.id, {
    ...previous,
    liked: !previous.liked,
    likes: previous.likes + (previous.liked ? -1 : 1),
  });
  try {
    cache.set(post.id, await api.setLike(post.id, !previous.liked));
  } catch {
    cache.set(post.id, previous);
    notifyError("like-failed");
  }
}

Use it for cheap actions that almost always succeed: likes, sending a message (with status: "sending"), reordering. Do not use it where a false "done" costs money or trust: in product-checkout, the payment button shows a pending state and only the server's answer shows success.

Errors and retries

  • Retry network errors and 5xx responses with exponential backoff and jitter, and a limit. Do not retry 4xx, except 408 and 429 (respect Retry-After).
  • Retry only requests that are safe to repeat: GET, or writes with an idempotency key so the server can drop the duplicate. Payment APIs commonly accept such a key in a request header.
  • Cancel requests whose answer is no longer needed. In an autocomplete, the response for "lap" can arrive after the one for "laptop"; abort the old request with AbortController, or ignore any response that does not match the current query.
  • Give every async view three more states besides success: loading, empty, error with a retry.
SeniorWeb platform

Stage 5: Optimizations

Pick the two or three areas that matter most for this product and go deep; a list of every technique you know reads as a lack of priorities. Tie each choice to a requirement or a metric.

Rendering strategy. CSR is fine behind a login (a dashboard, an editor). SSR gives a fast first paint and SEO for public, personalized pages, at the cost of server work and . SSG, or static pages regenerated in the background, suits content that changes rarely (product descriptions, articles). A common mix for a store: product content rendered on the server, cart and recommendations hydrated on the client.

Loading. Split code per route and lazy-load heavy widgets (rich text editor, charts, video player). Serve static assets from a CDN with long cache lifetimes and hashed file names. Preload what the first screen needs.

Images. srcset and sizes for responsive sizes, AVIF or WebP, loading="lazy" below the fold, explicit width and height so nothing shifts, and fetchpriority="high" for the image that is likely the element.

Long lists. Virtualize: render only the visible rows plus a small buffer, which is mandatory for an infinite-feed with thousands of items. Keep row heights stable or measured, and restore scroll position on back navigation.

Core Web Vitals. LCP at most 2.5 s, INP at most 200 ms, CLS at most 0.1, measured at the 75th percentile of real page loads. INP replaced FID as a Core Web Vital in 2024. Measure in the field (RUM), not only in Lighthouse.

Accessibility. Semantic HTML first; the WAI-ARIA combobox pattern for autocomplete; a live region for new chat messages; focus management in dialogs and after route changes; a pause button and prefers-reduced-motion for a carousel; captions for video.

i18n. No strings in code, plural rules per language, Intl for dates, numbers and currencies, CSS logical properties for right-to-left layouts, room for longer translations.

Offline and bad networks. A service worker caches the app shell; writes go to an outbox and are replayed when the connection returns; the UI shows the connection state.

Security. Untrusted text is rendered as text (React escapes it, except dangerouslySetInnerHTML); rich content is sanitized; a Content Security Policy limits where scripts can come from. Keep session tokens in HttpOnly, Secure, SameSite cookies rather than localStorage, which any injected script can read; protect cookie-authenticated writes against CSRF.

SeniorExample

The classic problems and their deep dives

Most rounds reuse a small set of problems. Each one has a crux, the part where the interviewer wants depth. The platform's System Design Board has all of these:

ProblemClarify firstExpected deep dive
autocompleteData source, minimum query, rich results, devicesDebounce, cancelling stale requests, caching by query, combobox keyboard and screen reader support
image-carouselAutoplay, number of images, touch, thumbnailsComponent API (controlled index), loading neighbors lazily, layout stability, pause and reduced motion
infinite-feedContent types, real-time updates, scaleCursor pagination, virtualization, "new posts" banner instead of jumping content, scroll restoration
chat-app1:1 or groups, history size, offline, attachmentsWebSocket and reconnection, normalized store, optimistic send with clientId, ordering, unread counts
collaborative-editorConcurrent editors, offline editing, rich textConflict resolution (operational transformation or CRDTs such as Yjs or Automerge), presence and cursors, undo per user
product-checkoutPayment methods, guest checkout, marketsForm validation and errors, idempotent payment requests, no optimistic success, hosted payment fields, accessible forms
video-playerLive or on demand, DRM, captions, devicesAdaptive streaming (HLS or DASH through Media Source Extensions), buffering states, keyboard controls, <track> captions
analytics-dashboardRefresh rate, number of widgets, data sizeFetching per widget, polling vs SSE, chart rendering (SVG or canvas), virtualized tables, time zones
multi-brand-design-systemNumber of brands, what differs, release processDesign tokens, runtime vs build-time theming, brand configuration for features and markets, per-brand bundles

State trade-offs, not verdicts

Each deep dive is a choice between options, and the answer is the reasoning, not the option. A useful sentence shape:

Option A gives us X, but costs Y. Given requirement Z, I choose A. If Z changed (for example, we needed SEO), I would switch to B.

For example: "Polling every 30 seconds is simpler to build and operate than SSE. The dashboard's requirement is data no older than a minute, so I choose polling. If traders needed second-by-second prices, I would move the price widgets to SSE."

Numbers make trade-offs concrete. "Ten suggestions of about 100 bytes each is 1 KB, so caching the last 50 queries in memory is free" is a stronger argument than "caching is good".

SeniorInterview tips

Interview tips

Open with a plan. "I'll start with requirements, then draw the client architecture, then the data model, component and API design, and finish with the optimizations that matter most here." It shows structure in one sentence and gives the interviewer a map to steer with.

What interviewers look for

Middle level: a complete, working design with sensible defaults. Clear requirements, a diagram where every box has a job, a normalized data model, components with real props and endpoints with real shapes. Loading, empty and error states covered. Correct use of standard tools: debounce, cursor pagination, a server-state cache, lazy loading.

Senior level: everything above, plus driving the conversation. Prioritizing what matters for this product, stating trade-offs with numbers, naming failure modes (a dropped connection, a duplicate payment, a stale cache) and their handling, raising accessibility, i18n and security without being asked, and knowing when not to add complexity ("polling is enough here"). Seniors also talk about delivery: feature flags, metrics to watch after launch, real-user monitoring.

Mistakes that cost points

  • Drawing or naming libraries before asking a single question.
  • Designing the backend (databases, sharding) instead of the client.
  • Long silences. Think out loud, even when unsure: "I'm deciding between cursor and offset pagination; the feed changes often, so..."
  • Listing every optimization without priorities or a link to the requirements.
  • Forgetting the unhappy paths: slow networks, errors, empty results, offline.
  • Keeping assumptions in your head instead of writing them down.
  • Defending a choice after the interviewer has added a requirement that breaks it. Change the design and say why.

Practise on the Board

Each problem on the System Design Board has fields for every stage and a reference design to compare with. Time yourself for 45 minutes, then compare stage by stage: which requirements you missed, which states your data model could not express, which trade-offs you left unstated.

MiddleReview checklist

What to check when reviewing a frontend system design

Use this list for a frontend design you did not write: a teammate's design doc, a library's reference architecture or an AI assistant's proposal. Gaps such as state with no owner or a missing error state are cheap to fix on paper and cost a rewrite after the build.

  • Are requirements, assumptions and out-of-scope items written down, with numbers? Look for devices, network, accessibility, languages and scale (items on a screen, update rate). Every choice, such as a library or a service worker, should trace back to a requirement.
  • Does every piece of state have exactly one home? For each thing on screen, decide: server state (in the cache), client state, URL state or derived. Flag derived values stored separately, and filters kept in component state that should survive a reload.
  • Is each entity stored once, by id? If the same user object is copied into every item, an update leaves two versions on screen. In a normalized store lists hold ids, so one change updates one place.
  • Does every cache key contain every input that changes the response? Compare each endpoint's parameters with its key: ["products", { category, locale }], not ["products", category], or cached results show in the wrong language. Check which keys each mutation invalidates.
  • Does each endpoint have a method, parameters, a response shape and an error contract? With offset pagination, items inserted at the top shift every page, giving duplicates or gaps; cursors avoid that. Errors need status codes, a machine-readable code and a place in the UI: inline or a retry banner.
  • Are the unhappy paths designed? Every async view needs loading, empty and error-with-retry states. Retries are limited, back off, and repeat only safe requests (GET, or writes with an idempotency key); stale requests are cancelled with an AbortSignal; optimistic updates keep the previous value to roll back.

Check your understanding

  • Practice

    Predict-output and open interview questions with self-assessment.

    0 predict-output · 6 open

  • Quiz

    Multiple-choice questions with explanations and a score.

    6 questions