System Design: News Feed for a Food Discovery App
Context
You are designing a news-feed feature for a mobile/web food discovery app where users explore dishes, restaurants, and creator posts. The feed is a scrollable list of items and a tap opens a detailed view. Assume a mix of global and lightly personalized feeds (by cuisine, location, or follows) and mobile clients with intermittent connectivity.
Requirements
Feed and Detail
-
Feed items show: title, author, summary, engagement counts (likes, comments, saves), thumbnail.
-
Detail view shows: full description, images, comments (threaded or flat), related items.
-
Infinite scroll on feed and comments.
-
Rank by a blend of recency and engagement.
-
Basic search and filter (e.g., keywords, cuisine tags, location radius, author).
Data and Operations
-
CRUD for posts and comments, reactions (like/save) on posts and comments.
-
Data model and storage for posts, comments, reactions, counters, and related items.
Interfaces
-
Read/Write APIs with pagination (cursor-based preferred), idempotency for writes.
Architecture & Platform
-
End-to-end request path: edge/CDN, API gateway, stateless app tier, caches, DB, background jobs, queues/streams, data processing/indexing.
-
Caching, indexing, and denormalization for fast reads.
-
Scalability: partitioning/sharding, rate limiting, backpressure, horizontal scaling.
-
Consistency choices (strong vs eventual) and idempotency.
-
Error handling and retries (client/server), DLQs.
-
Observability: logging, metrics, tracing, SLOs.
-
Performance optimizations for p95 latency and cost.