KatInterview

Front-End Design: Scalable Product Search with Unbounded Results

System DesignModel answer
HardModel answerSystem Designfrontendsearchpagination

Last updated

Design the component tree and performance strategy for a search-driven product grid that must handle an arbitrarily large catalog.

Product Search Page — Front-End System Design

You are building the front end for an e-commerce search experience. At the top of the page sits a text input. Below it, a grid of product cards updates to reflect the user's current search term. The underlying catalog has no practical size limit, so any given query could return thousands of matching products.

Your interviewer wants two things from you:

  1. The component hierarchy — what components exist, what each one is responsible for, and where shared state lives.
  2. A performance strategy — how you keep the experience fast and correct as the user types, given that the full result set can never be held in the browser at once.

This is a design discussion, not a coding exercise. Lead with the decisions that matter most and explain your trade-offs.


Before You Design — Clarify These

State your assumptions if answers are not given:

  • Do results update on every keystroke, or only on an explicit submit (Enter / button click)?
  • Does a search API already exist? Does it return paginated results, a total count, and support cursor- or offset-based paging?
  • What does a product card display — image, name, price, rating?
  • Do you use infinite scroll or numbered pagination?
  • Should the search term appear in the URL so the page can be bookmarked and shared?
  • Which devices and network conditions are in scope (mobile on 4G, desktop on broadband)?

Part 1 — Component Tree and State Ownership

Describe the component hierarchy. For each component, state what it renders and what state or props it owns. Cover:

  • How the search term and the current results flow through the tree
  • Where loading, empty-results, and error states live and how they are displayed without causing layout shifts
  • How the active query stays in sync with the URL

Part 2 — Keeping Results Fast for an Unbounded Catalog

Explain how you make the grid feel responsive after each keystroke when the result set can be arbitrarily large. Cover:

  • How you control the number of outgoing requests and handle responses that arrive out of order
  • Whether and how you cache results, and when the cache is invalid
  • How you page through results and limit rendering cost as the user scrolls or pages forward
  • What requirements you place on the backend search API to make all of this work

Hints

Hint 1

Start with clarifying questions — whether results update on every keystroke versus on submit changes almost every decision that follows, especially how aggressively you debounce and how you handle stale responses.

Hint 2

For Part 1, find a single component that owns the query string, the current result page, and the request status. Everything else should be a pure consumer. Ask yourself: if two sibling components both need the search term, where does it live?

Hint 3

For Part 2, think in three layers — client (debounce, cancel stale requests, in-memory cache), network (CDN-cacheable API responses, connection reuse), and server (inverted index, pre-computed relevance scores). A complete answer touches all three and names a trade-off for each technique.