Nearby Places Search
mediumOpen designCommonly asked~30 minHLD roundPhone screenSDE-2 and upGoogleSwiggyUberFlipkartAmazonMicrosoftGeospatialStorage & Data ModellingCaching
The question, as asked
“Design the 'restaurants near me' backend. Given a location and a radius, return the places nearby — fast, for millions of users.”
Scope it before you design it
The prompt is vague on purpose. These are the clarifying questions a strong candidate asks first — answer them out loud before you touch the architecture.
- Are the things being searched static or moving? Static places versus live riders are different systems — one is a cached read index, the other is a write-heavy in-memory store.
- How many places, and how many queries per second? A million places is small; the query volume is what drives the design.
- Is the radius fixed or user-chosen? A variable radius affects which index resolution you can precompute at.
- Does the result need ranking beyond distance — rating, open-now, price? That turns a geo lookup into a geo filter plus a ranking pass.
- Exact distance or approximate? 'Within about 5km' lets you answer from cells alone; an exact radius needs a post-filter.
- Read-heavy or write-heavy? This is the single question that picks the design, so ask it explicitly rather than assuming.
Your answer, first
Commit something before anything unlocks. Saved on this device as you go.
0 charactersExpand for room to draw
Framework hint
Sketch or write your approach above first. The hint gives you the structure, not the answer.