FSD Frontend System Design

Chapter 10 · Low Level Design

Interview drill

15 questions from this chapter. Answer each one out loud first, then open it to compare.

  1. 10.1"Design a reusable Table component."
    • Start with the API out loud: columns config, data, onSort, renderCell for escape hatches, slots for empty and error states.
    • Keep sorting and pagination controlled so the parent can drive them from the URL (6.10).
    • Name the accessibility contract — real <table> semantics, scope on headers, sortable columns announcing aria-sort.

    Review 10.1 Component Design →

  2. 10.2"How would you build a home screen that changes without a release?"
    • Server returns an ordered list of typed sections; the client maps types to components via a registry.
    • Validate the config, ignore unknown types for forward compatibility, and version the schema.
    • Keep data fetching per section (each declares its own source) so one slow API doesn't block the whole screen — stream or lazy-load below the fold.

    Review 10.2 Config Driven UI →

  3. 10.3"Spinner or skeleton?"
    • Skeleton when the layout is known and the wait exceeds a second — it removes the layout shift and sets expectations.
    • Spinner for short or unpredictable waits; nothing at all under ~300ms.
    • Best of all is stale-while-revalidate, so returning users see content instantly and it refreshes underneath.

    Review 10.3 Shimmer UI →

  4. 10.4"How do you protect routes in an SPA?"
    • A guard component wrapping the protected subtree, driven by a three-state auth value so refresh doesn't flash the login page.
    • Preserve and validate the return path, and use replace so the back button doesn't bounce between login and page.
    • Say plainly that this is presentation only — the server authorises every request regardless of what the client renders.

    Review 10.4 Routing & Protected Routes →

  5. 10.5"Redux or Context?"
    • Neither, usually — most of what people put in Redux is server state and belongs in a query cache.
    • Context broadcasts to every consumer, so it fits low-frequency values like theme and locale, not a cart.
    • For genuine global client state I'd default to a selector-based store and reach for Redux Toolkit when the team needs strict conventions, middleware, or time-travel debugging.

    Review 10.5 State Management + Libraries →

  6. 10.6"How would you add multi-language support to an existing app?"
    • Extract to keys with a source bundle, wire Intl for all formatting, and lazy-load one locale at a time.
    • Fix layout for text expansion and switch to logical CSS properties so RTL is a dir attribute, not a second stylesheet.
    • Decide URL strategy early — /de/path is best for SEO and shareability, and it makes locale a routing concern rather than hidden state.

    Review 10.6 Multi Language Support →

  7. 10.7"Build an infinite feed. What breaks first?"
    • The DOM: without virtualization, memory and scroll performance degrade after a few hundred items.
    • Offsets: with items being inserted at the top, offset pagination duplicates and skips — use cursors.
    • Then the details that get skipped: the double-fire guard, the end state, scroll restoration, and a keyboard-accessible load-more.

    Review 10.7 Infinite Scroll →

  8. 10.8"Build an accordion."
    • Ask single or multiple first, because it decides the state shape.
    • Buttons inside headings, aria-expanded and aria-controls wired, hidden on closed panels, focus staying on the trigger.
    • If the content is heavy, lazy-render panels on first open and keep them mounted afterwards to preserve scroll and form state.

    Review 10.8 Accordion →

  9. 10.9"Build Reddit-style nested comments."
    • Normalized flat store, memoised parent→children map, recursive component with a depth prop.
    • Cap indentation around five levels and link deeper threads to their own view — this is a UX requirement, not a shortcut.
    • For very large threads, flatten to a visible-nodes array and virtualize; recursion and virtualization don't compose easily.

    Review 10.9 Nested Comments →

  10. 10.10"Build an image carousel."
    • Track with a single translateX, transform-only animation, neighbour preloading, and pointer-based swipe with a commit threshold.
    • Autoplay pauses on hover, focus, and hidden tab, stops after interaction, and honours reduced motion.
    • Mention CSS scroll-snap as the simpler path when autoplay isn't required — it gives you momentum and accessibility for free.

    Review 10.10 Image Slider →

  11. 10.11"Why did the same item appear on two pages?"
    • Offset pagination on a list that receives inserts — every new row at the top shifts the window by one.
    • Cursors fix it because position is defined by the row you last saw, not by a count.
    • Keep a unique tiebreaker in the sort key, or identical timestamps will still cause skips at boundaries.

    Review 10.11 Pagination Part-1 →

  12. 10.12"Build a pagination component."
    • Start with the API: total, page, pageSize, onChange — and state that page lives in the URL, not in the component.
    • Extract the ellipsis range into a pure function so it's unit-testable, and keep the slot count fixed to avoid layout shift.
    • Use <nav> with aria-current="page" and real links, so keyboard, screen reader, and middle-click all behave correctly.

    Review 10.12 Pagination Part-2 →

  13. 10.13"Live updates arrive while the user is scrolled into the feed. What do you do?"
    • Buffer inserts behind a "N new posts" banner and keep scroll anchored; only auto-insert when the user is at the top.
    • Patch entities by id in a normalized store so unrelated rows don't re-render.
    • Handle sequence numbers, reconnect deltas, and dirty local fields — those three are what separate a real implementation from a demo.

    Review 10.13 Real-Time Updates →

  14. 10.14"Design live chat for a stream with 500k viewers."
    • Client side: buffer and flush on a frame, cap the window, virtualize, and pin to bottom only when the user is already there.
    • Transport: SSE or WebSocket per viewer, fanned out from a pub/sub layer — and at extreme volume the server samples messages rather than sending all of them.
    • Say the quiet part: nobody can read 300 messages a second, so sampling and "chat paused" are features, not degradations.

    Review 10.14 YouTube Live Stream Chat UI →

  15. 10.15"Build an autocomplete. What are the failure modes?"
    • The race: an earlier slow request landing after a later fast one — fix with AbortController and a stale-response check.
    • The traffic: no debounce and no minimum length means a request per keystroke.
    • The accessibility: it's a combobox with aria-activedescendant, so focus stays in the input while arrows move the selection — most implementations get this wrong.

    Review 10.15 Autocomplete & Search Bar →