System design · HLD

Yelp

Functional req

1.user should be able to search by business , category , location (long/latitue)

2user should be able to view business and reviews

3user should be able to add review for a business (mantary 1-5 star , optional text)

Non-functional

1.Availibility > consistency , its okay if adding review takes time to reflect
2.low latency on search < 500ms

3.system should be able to handle 100m DAU and 10M business

Core entities
1.user
2.business - store the category , name , long /latitude

3reviews - reviews added by user for a business (userid , businessid, rating , optional text)

Api

// user able to search by business , category , location (long/latitue)
GET /businesses?category&query&location&page -> business[]

Use pagination as it can return large set of result

//user should be able to view business and review
GET /businesses/:businessId -> Business
GET /businesses/:businessId/reviews?page= -> Review[]
// user should be able to add review for a business
POST /businesses/:businessId/reviews
{
  rating: number,
  text?: string
}

https://claude.ai/public/artifacts/f067a95a-82c2-4f88-88ae-896bb4bbe735