Design a Microblogging Dashboard From a Given Schema
Design a Twitter-like platform starting from four tables: tweets(tweet_id, text, account_id, created_at), follow(follow_from_account_id, follow_to_account_id, created_at), likes(tweet_id, liked_from_account_id, created_at) and accounts(account_id, created_at).
Base interactions: create and delete tweets; view your own tweets and any account's tweets; follow accounts; like and unlike any tweet, followed or not; list who follows you and whom you follow.
Then the dashboard: a paginated home feed showing the top X tweets for each user, ranked by signals such as tweets from accounts you follow, tweets with many likes, tweets with many recent likes, recently created tweets, tweets from accounts you recently followed, recently viewed, or view often.
Design the APIs, the storage, and how the feed is generated and paginated. No scale numbers are given; state your assumptions and show how the design changes if they are wrong.
Hints
Hint 1
Index the given tables for the base reads first: tweets by (account_id, created_at desc), follows both ways, likes by tweet and by account. Most of the base interactions are then one indexed query.
Hint 2
The dashboard mixes a follow graph (fan-out) with global popularity signals; precompute what is cheap to keep fresh (like counts, recent-like counts) and score candidates at read time.
Hint 3
Paginate a ranked feed with a cursor over (score, tweet_id) captured at the first page, or materialise a per-user snapshot of X items and page through it; offsets over a changing ranking skip and repeat items.
Asked at
Sign in to talk to the interviewer — ask what's in scope, what scale to design for, or for a nudge when you're stuck. Conversations save to your account.
Sign in to use the assistant — ask what the problem means, get a hint when you're stuck, or have your current work reviewed. Conversations save to your account.