Design Reddit
HardSystem design · Social
Design Reddit: communities (subreddits), posts, deeply threaded comments, up/down votes, ranked listings (hot, new, top) and community moderation. Focus on comment-tree storage and partial loading, precomputed ranked listings, the vote write path, edge caching for anonymous readers and community-scoped moderation. Out of scope: ads, chat, and the recommendation of communities.
Requirements
- Store comment trees so subtrees and bounded depth can be fetched in one range query
- Rank posts with a score-and-age formula and comments with a confidence-adjusted score; keep listings precomputed
- Handle votes as idempotent per-user upserts aggregated asynchronously, avoiding a hot counter row
- Support community-level moderation (roles, automod, removal, mod log), abuse controls and edge caching