Design Network-Backed Search Suggestions
Design a client-side search-suggestion flow that debounces input, coordinates paginated prefix results, and mediates cached and remote data through a component hierarchy.
Design the client-side software for a search field that shows suggestions from an existing prefix-search backend as the user types.
Define an API contract that accepts a query, page, and result limit, coordinate cached and remote results, render through a component tree and portal manager, define the external component contracts and exported-versus-internal boundary, compare throttling with debouncing, and discuss exact-prefix, similarity-based, and popularity-based suggestion strategies.
For this exercise, assume non-empty input uses a short debounce; clearing the field cancels pending work, resets pagination, and dismisses the overlay; the overlay otherwise represents the current query's loading, content, or retryable-error state; late completions never replace the current query; page 1 replaces results while a valid next page appends; and the exact-prefix baseline is a bounded page-aware LRU with expiry, a testable clock, and optional stale-while-refresh display.
Clarify any remaining product behavior, then model the objects, interfaces, and complete request and pagination flows.