The whole course ▾

System Design · Mock interview 9 of 20

Design Yelp: places near you

Updated 22 Oct 2026 · By Akshay, software engineer, India · 9 min read

Design a local discovery app like Yelp.

Try it first

Before you read the interview, answer the question yourself. Give yourself 10 minutes: say your design out loud, or sketch it on paper. What would you ask? Which numbers matter? Which boxes, and what's the hard part? Then read on, and score yourself with the feedback at the end.

The video for this mock interview is coming soon.

New System Design videos go up at 6 pm. Subscribe on YouTube so you don't miss it.

Got a doubt? Ask in the comments under the video.Subscribe

Requirements

Requirements
Clarifying questions
->
Search by? -> Place, category and text
->
Scale? -> 200M places, 100M daily users
->
Reviews? -> Yes, with star ratings
->
Do places move? -> Almost never
Functional requirements
Search near a point, with filters
View a place: details, photos, reviews
Write a review with stars
Owners update their details
Non-functional requirements
->
Search answers in under 200 ms
->
Reads far outnumber writes
->
Ratings may lag a few minutes
->
Highly available
Out of scope
Booking tables and ordering
Ads and promoted places
Personal recommendations
interviewer
Hi, thanks for joining. Shall we get started?
candidate
Sure. I'll sketch as I go.
interviewer
Design a local discovery app, like Yelp. Finding restaurants, cafés and shops near you, reading reviews, writing your own.
candidate
Okay. That sounds a bit like ride-hailing, since both search nearby, so I want to find out what's different first. A few questions?
interviewer
Go ahead.
candidate
Search by what?
interviewer
By location, by category, like coffee, and by free text.
candidate
What scale?
interviewer
Two hundred million places worldwide, and a hundred million daily users.
candidate
Do we handle reviews?
interviewer
Yes, with star ratings.
candidate
And do places move?
interviewer
Almost never.
candidate
That's the big difference from a taxi app, where every driver moves every few seconds.
candidate
So, what it must do. Search near a point, with filters: category, open now, minimum rating. View a place, with its details, photos and reviews. Write a review, with one to five stars. And business owners can update their hours, menu and photos.
candidate
And how well. Search answers in under two hundred milliseconds. Reads far outnumber writes: people search much more than they review. Ratings may lag a few minutes behind new reviews. And it's highly available, because people search when they're hungry.
interviewer
All fair.
candidate
I'll leave out booking tables and ordering, ads, and personal recommendations. Does that match what you had in mind?
interviewer
Yes. Focus on search first.

Estimation

Estimation
Back of the envelope
100M users × 5 searches = 500M a day
÷ 100,000 s = 5,000/s; peak ~ 15,000/s
Reviews: ~1M a day ~ 10 writes/s
Places: 200M × ~1 KB ~ 200 GB
WHAT THE NUMBERS DECIDE
Searchesoutnumberwrites
1,000to1,andplaces
don'tmove:precompute,
andcacheeverything.
candidate
Let me size it.
interviewer
How much traffic, and how much data?
candidate
I'll use a hundred thousand seconds in a day, and peaks about three times the average.
candidate
A hundred million users making about five searches a day is five hundred million searches: five thousand a second, with a peak around fifteen thousand. New reviews are maybe a million a day, so about ten writes a second. And the places, two hundred million at about a kilobyte each, are around two hundred gigabytes. Photos are separate, in object storage behind a CDN.
interviewer
Are searches spread evenly?
candidate
No. Lunch, dinner and weekends are the peaks, which is why I plan for three times the average.
candidate
So searches outnumber writes about a thousand to one, and places almost never move. That means the geo index can be built ahead of time, copied to every search server, and cached heavily. And two hundred gigabytes is small enough to copy anywhere.
interviewer
Good observation.

API and data

API and data
Places
location, category,
hours, rating sum and
count
Reviews
place, user, stars,
text, time
Users
1 : many
1 : many
Endpoints
1
GET
/search?lat&lng&radius&category&q
2
GET /places/{id}
3
POST /places/{id}/reviews + key
4
GET /places/{id}/reviews?cursor
candidate
Next, the API, and the tables.
interviewer
What does the API look like?
candidate
Search, view, and review.
candidate
GET slash search, with a latitude, longitude and radius, an optional category and text, returning twenty places at a time. GET slash places, an ID, for one place's details. POST a review, with an idempotency key, so a double-tapped Submit posts one review. And GET a place's reviews, with a cursor.
interviewer
Mostly reads, then.
candidate
Everything except posting a review.
candidate
Three tables. Places: location, category, hours, and two numbers for the rating, the sum of all stars and the count of reviews, so the average is one division away. Reviews: which place, which user, the stars, the text and the time. And users. I'd shard reviews by place ID, so a place's reviews live together, and places by geography.
interviewer
Why keep a sum and a count?
candidate
So a page never averages thousands of reviews on every view.

High-level design

High-level design
Mobile
app
API
gateway
Search
service
geo index
in memory
Place
cache
Places DB
leader +
replicas
coffee
near me
1
2
place
details
3
on a miss
Review
service
Reviews
DB
sharded by
place
Kafka
review
events
Rating
updater
POST
review
4
save
5
review
added
6
sum + 5, count + 1
7
Why two paths
->
Search: in memory, everywhere,
read-only
->
Reviews: durable writes, sharded by
place
->
Joined by events, not shared tables
TWO RISKS
Nearbysearchmuststay
fastat15,000a
second.Ratingsmustbe
correct,andfair.
interviewer
Okay. Show me the design.
interviewer
Walk me through a search, then a review.
candidate
Search first, since it's almost all of the traffic.
candidate
The mobile app sends coffee near me through the API gateway to the search service. Each search server holds the whole geo index in memory, so finding nearby place IDs is a local lookup. It filters and ranks them, then fetches the top twenty places' details from a place cache, which falls back to the places DB, through read replicas, only on a miss. Most of the time, a search runs without a single database query.
interviewer
How big is the place cache?
candidate
The popular places fit in a few gigabytes. Most searches land on the same well-known spots.
candidate
A review takes a different path. The review service saves it in the reviews DB, and publishes review added to Kafka. A rating updater reads those events and adds to the place's star sum and review count, in batches. The review appears on the page at once, and the average catches up within a minute or two.
interviewer
Why batch?
candidate
A famous place getting hundreds of reviews an hour then updates its row a few times, not hundreds.
candidate
So the two paths are built differently on purpose. Search is read-only, held in memory, and copied to every server. Reviews are durable writes, safely stored and sharded. They're joined by events, not shared tables, so a flood of new reviews can never slow down search.
interviewer
What if Kafka falls behind?
candidate
Then ratings lag a little longer, and search doesn't notice at all.
interviewer
What would you want to go deeper on?
candidate
Two things. How nearby search stays under two hundred milliseconds at fifteen thousand searches a second. And how ratings stay correct, and fair, when one place has a single review and another has two thousand.
interviewer
Speed first.
Deep dive: nearby search
Fixed geohash cells
Same size everywhere
Manhattan cells hold thousands
Desert cells hold nothing
A quadtree, built nightly
Splits where places are dense
About 100 places per leaf
Static data: build once, copy
THE CHOICE
Aquadtreebuiltnightly,held
inmemoryoneverysearch
server;widenthesearchuntil
thereareenoughresults.
High-level design
Mobile
app
API
gateway
Search
service
geo index
in memory
Place
cache
Places DB
leader +
replicas
coffee
near me
1
2
place
details
3
on a miss
Review
service
Reviews
DB
sharded by
place
Kafka
review
events
Rating
updater
POST
review
4
save
5
review
added
6
sum + 5, count + 1
7
~8 GB quadtree, rebuilt
nightly
Why two paths
->
Search: in memory, everywhere,
read-only
->
Reviews: durable writes, sharded by
place
->
Joined by events, not shared tables
TWO RISKS
Nearbysearchmuststay
fastat15,000a
second.Ratingsmustbe
correct,andfair.
interviewer
Let's start with the geo index.
interviewer
How do you find places near a point, fast, among two hundred million?
candidate
There are two common answers. Let me compare them for this case.
candidate
Fixed geohash cells are the same size everywhere, so a cell in a dense city holds thousands of places, and one in the desert holds none. A quadtree splits wherever places are dense, so every leaf holds about a hundred places. And since places almost never move, the quadtree can be built once a night and copied to every search server. Two hundred million entries at forty bytes is about eight gigabytes: it fits in memory.
interviewer
Why not a database with a geo index, like PostGIS?
candidate
It would work, but fifteen thousand searches a second would need many replicas. Memory is simpler, and faster, here.
candidate
So, a quadtree built nightly and held in memory on every search server. Finding nearby places means finding the leaves that overlap the search circle, then filtering by real distance. And if there aren't enough results, I widen the circle and look again, so a village search still finds the nearest café, even ten kilometres away.
interviewer
Nice.
candidate
So every search server holds the nightly quadtree. Adding servers is easy, because each one is an identical, read-only copy. Fifteen thousand searches a second across thirty servers is only a few hundred each, all answered from memory.
interviewer
How do the servers get the new tree?
candidate
The nightly job writes it to object storage. Each server loads it and swaps it in, one server at a time.
interviewer
A new café opens at noon. Does it wait until tomorrow to appear?
candidate
No. New and changed places go into a small live index, updated from Kafka within seconds, and each search checks both the nightly tree and the live index. Tonight's rebuild then folds the new café into the main tree.
interviewer
And filters, like open now, and four stars or more?
candidate
Find nearby candidates first, a few hundred at most, then filter them in memory, using each place's hours in its own time zone, and its rating. For free text, like vegan brunch, the same filtering runs in a search engine with a geo filter.

Deep dive: fair ratings

Deep dive: fair ratings
Correct ratings
1
Store a star sum and a review count
2
Update them from review events
3
Idempotent by event ID
4
Edits send the change: 2 -> 5 is +3
FAIR RANKING
RankwithaBayesian
average:fewreviewspull
aplacetowardsthe
overallaverage.
interviewer
Now, the ratings.
interviewer
How do you keep ratings correct, and fair, with a million new reviews a day?
candidate
Correct first, then fair.
candidate
For correctness, keep a star sum and a review count on each place. Update them from review events, in batches. Make the updater idempotent by event ID, so a redelivered event isn't counted twice. And when someone edits a review from two stars to five, the event carries the change: add three to the sum, and leave the count alone.
interviewer
What if the updater crashes mid-batch?
candidate
It starts again from the last committed offset, and the event IDs stop anything being counted twice.
candidate
Now fairness. A café with one five-star review shouldn't outrank one with two thousand reviews averaging four point seven. So I'd rank with a Bayesian average: pretend every place starts with a few reviews at the overall average, then add its real ones. One five-star review barely moves it; two thousand reviews speak for themselves.
interviewer
And distance?
candidate
Ranking blends that in, so a great café a bit further away can still win.
interviewer
A rival posts fifty fake one-star reviews on a café in an hour. What happens?
candidate
Rate limit reviews per account. Hold reviews from brand-new accounts, or ones that come in sudden bursts, for checking before they count. And because ratings come from events, removing fake reviews later just sends events that subtract them.
interviewer
A famous restaurant gets thousands of page views a second. Any problem?
candidate
Its page is one hot key, so I'd cache it at several layers: the place cache, with replicas for that key, and a short cache at the CDN. A few seconds of staleness on a review count costs nothing.
interviewer
Good.

Wrap-up

Wrap-up
Next steps
1
Personal ranking: places you'd like
2
Fake review detection, offline
3
Regions near users
4
Watch search latency and empty results
INTERVIEWER'S FEEDBACK
Strong:spottedstaticdata,a
nightlyquadtreeinmemory,cached
reads,fairratings.Nexttime:give
photosaminute.Verdict:hire.
interviewer
A few minutes left.
interviewer
What would you improve with more time?
candidate
A few things.
candidate
First, personal ranking: places you'd probably like, from your past reviews and searches. Second, better fake review detection, as an offline job. Third, serving from regions near users, which is easy here, because the place data is read-only and simply copied. And fourth, I'd watch search latency, and how often a search returns nothing. That shows where the map is thin.
interviewer
Which would you do first?
candidate
Watching empty results. They show exactly where users are let down.
interviewer
Okay, let's stop there. Nicely done. You noticed places don't move, and built the whole design around it: a quadtree built nightly and held in memory, with a small live index for changes. Reads are cached everywhere, and ratings are correct with event-driven sums, and fair with a Bayesian average. One gap: billions of photos deserve a minute of their own. I'd say a hire.
candidate
Thanks. Photos next time.
Interviewer's feedback

Strong: spotted static data, a nightly quadtree in memory, cached reads, fair ratings. Next time: give photos a minute. Verdict: hire.

Score yourself

Interviewers score these seven things. Give your own attempt a tick for each one you did.

  • Asks before drawing. Agrees what the system does, and how well: scale, speed, consistency.
  • Turns users into requests a second and bytes a day, and says what the numbers decide.
  • A small, clear contract, and a data model that fits how the data is read.
  • A working path end to end before any detail. Every box has a reason.
  • Picks the hard parts, compares two options, and chooses one with a trade-off said out loud.
  • What breaks, what happens then, and how users notice. Retries, duplicates, limits.
  • Thinks out loud, checks in with the interviewer, and takes a hint without losing the thread.

0 of 7

Your progress stays on this device.
New System Design videos at 6 pm

Lessons on weekdays, the week's revision on Saturday, a mock interview on Sunday.