Preparing your design workspace

Loading the problem and your saved attempt…

Design a Persistent Chronological Social Feed

Model users, posts, follows, and an indexed durable feed that returns the newest eligible posts deterministically.

Design a persistent social news feed. Users create posts, follow and unfollow other users, and request the newest 10 eligible posts from authors they currently follow plus their own posts, sorted by server creation time descending and immutable post ID descending as the final tie-breaker.

For this exercise, assume a relational database is the system of record; follow pairs and post IDs are unique, self-follow is unnecessary, create-post retries carry an idempotency key, and feed reads use cursor pagination over the same ordering. Unfollow affects new feed reads immediately but does not delete posts.

Define the object model, service and repository interfaces, relational schema, constraints, and indexes that support every method without scanning all posts. Likes, comments, media, ranking by engagement, fan-out materialization, and real-time push are outside scope.