Design a Customer Review Page
DoorDashSoftware Engineer · Technical ScreenLast updated
This question tests the ability to design a scalable review system capable of handling high-write volume, media storage, and efficient retrieval with pagination.
Design a Customer Review System
Design a backend system for a food delivery platform where customers can leave reviews for restaurants and orders. The system needs to support high concurrency during peak dining hours and provide a seamless reading experience for other users.
Functional Requirements
- Users can post a review (text, rating 1-5, and optional image/video).
- Users can fetch a paginated list of reviews for a specific restaurant.
- Users can upvote or downvote helpful reviews.
Non-Functional Requirements
- Low latency for reading reviews (page loads should be under 200ms).
- High availability for writing reviews.
- The system should support eventual consistency for review counts and sorting.
Deliverables
- API Design: Define the primary endpoints for posting, reading, and voting on reviews.
- Data Model: Propose a schema for the database (SQL vs NoSQL).
- Storage & Media: Explain how you handle uploaded media (images/videos).
- Scale & Performance: How would you handle hot restaurants with thousands of new reviews per hour? Mention caching strategies and pagination techniques.
Hints
Hint 1
Consider the trade-offs between a relational database for transactional integrity and a NoSQL database for horizontal scalability.
Hint 2
For pagination, distinguish between offset-based pagination (simple but slow for large datasets) and cursor-based pagination (efficient for infinite scroll).
Hint 3
To handle high write volume and expensive read requests, think about using a write-behind pattern or asynchronous processing with a message queue.
Follow-up questions
- How would you prevent spam or fraudulent reviews from bots?
- If we wanted to implement a 'trending' reviews feature, what additional components would you add to your architecture?
- How would you handle the deletion of a review, considering that it might affect the restaurant's average rating calculation?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.