KatInterview

Design a Scalable Food Delivery Review Platform

System DesignModel answer
MediumModel answerSystem Designsystem-designdatabase-designcaching

Last updated

Design a backend architecture to capture, aggregate, and display diner reviews and media ratings at high volume with low read latencies.

Scenario

You are tasked with designing the backend infrastructure for a meal delivery platform's user feedback system. Customers routinely post rating scores, written commentary, and photos or videos after completing an order. Millions of prospective diners read these reviews every evening to decide where to order from.

Requirements

Functional Requirements

  1. Submit Feedback: Customers can publish a single review per completed order, consisting of a integer rating (1–5 stars), optional written text, and optional photos/videos.
  2. Display Restaurant Reviews: Prospective diners can view pages of published reviews for a given restaurant, with support for sorting by recency or by community helpfulness.
  3. Helpfulness Votes: Logged-in users can upvote or downvote existing reviews to highlight useful feedback.

Non-Functional Requirements

  1. Read Performance: The primary review page feed must return in under 200ms at $p_{99}$.
  2. High Write Availability: Submitting a review or casting a vote must accept writes smoothly during peak dinner hours without blocking or crashing application servers.
  3. Eventual Aggregation: Overall restaurant statistics (average stars, star counts, vote totals) can settle within seconds of submittal rather than requiring strict immediate transactions.

Deliverables

  1. API Specifications: Outline key HTTP or RPC contract endpoints for uploading media, persisting reviews, viewing reviews, and casting votes.
  2. Data Storage & Schema: Recommend a database technology stack and provide a relational or document table design.
  3. Media Pipeline: Explain how uploaded images and videos are securely handled without overloading application servers.
  4. Scale & Pagination: Detail how high-traffic "hotspot" restaurants are optimized for reads, including caching design and cursor-based pagination.

Hints

Hint 1

Decouple direct object storage file uploads from transactional database writes using signed temporary upload links.

Hint 2

Avoid offset-based pagination SQL queries on high-cardinality tables; use keyset composite cursors instead.

Hint 3

Decouple instantaneous write responses from aggregate statistic updates using transactional outbox events processed by background workers.