Skip to content
RED SAGSkills
mediumFull Stack Developer interview question

You need to build a product search page with text search, filters and sorting. Walk through the design from the UI to the database.

What the interviewer wants to hear

  • Keep search state in the URL query string so it is shareable
  • Debounce input and cancel stale requests
  • Design a validated API with filters, sort and cursor pagination
  • Use suitable indexes or full-text search in the database
  • Consider a search engine when needs grow (typos, ranking)
  • Cache common queries and measure performance

Model answer

On the frontend I store the search text, filters and sort in the URL query string, so results are shareable, bookmarkable and survive refresh. The input is debounced by around 300 ms, and I cancel stale requests so old responses never overwrite new ones. The API is GET /api/products with parameters like q, category, minPrice, sort and cursor; it validates and allowlists every parameter, especially sort fields, and returns items plus a next cursor. In PostgreSQL I start with full-text search using a tsvector column and a GIN index, plus B-tree indexes on common filter columns, and I check plans with EXPLAIN. Cursor pagination keeps deep pages fast. If we later need typo tolerance, synonyms or ranking tuning, I would sync data to a search engine like Meilisearch or Elasticsearch. Popular queries can be cached briefly at the CDN.

Can you answer it under time pressure?

Take a timed medium round and get scored on every answer.

Start mock interview

More medium Full Stack Developer questions