Katkat

Design a Review and Rating System for Food Delivery Menu Items

DoorDashSoftware Engineer · Onsite

Last updated

Design a review and rating system for a food-delivery platform, where customers review the individual menu items they received and every menu shows each item's rating. It tests data modeling, purchase verification, incremental rating aggregation, caching for read-heavy menus, moderation, and handling bursts on popular items.

Design a review system for a food-delivery platform: customers rate and review the individual food items they ordered, and people browsing a restaurant's menu see each item's rating and can read its reviews.

Assume the core features are:

  • A customer who received an order can give each item in it a rating on a 1-to-5 star scale and an optional written review.
  • Every menu item shows its average rating and number of ratings wherever the menu is displayed.
  • Anyone viewing an item can page through its reviews.

Constraints and Clarifications

  • Reviews are attached to individual menu items, not only to the restaurant or to the order as a whole.
  • The platform already has order, menu and user services that the review system can call or subscribe to.

Clarifying Questions

  • Can customers edit or delete a review, and for how long after delivery may they review an item?
  • Must reviews be moderated before they appear, or can they be published immediately and removed later?
  • How quickly must a new rating be reflected in an item's displayed average?
  • In what order should an item's reviews be listed: most recent, most helpful, or highest and lowest rated first?
  • Are photos, restaurant replies or "helpful" votes in scope?
  • What scale should the design handle: orders per day, menu views per day, and the share of ordered items that get reviewed?

Hints

Hint 1

Where the menu's numbers come from: Menus are viewed far more often than reviews are written. Decide where each item's average and count live so that showing a menu never requires scanning that item's reviews.

Hint 2

Proving the reviewer received the item: Decide how the write path verifies that the reviewer actually received the item, and what stops the same ordered item from being reviewed twice.

Follow-up questions

  • A promotion sends a burst of reviews to one item. Where does contention appear in your design, and how do you remove it?
  • How do you keep a new item with a single 5-star rating from being ranked above an item with hundreds of ratings averaging 4.7?
  • How would you detect and handle fake or abusive reviews, including a restaurant reviewing its competitors' dishes?
  • A restaurant renames or changes a dish. Should its existing reviews stay attached, and how would you model that?