Technical Interview Questions

WeChat Moments Feed System Backend Design

"Design the backend system for WeChat Moments (朋友圈). The system must handle posting, friend-scoped visibility, real-time feed generation, and privacy controls for over 1 billion users."

Why Interviewers Ask This

WeChat Moments is one of the most complex social feed systems in the world due to its strict friend-only visibility model (no public posts), fine-grained privacy controls, and massive scale. This question tests backend architecture skills across storage, feed generation, social graph traversal, and privacy enforcement.

How to Answer

  1. 1

    Define the core data models: posts (content, author, timestamp, visibility settings), social graph (friend relationships, blocked users, visibility groups), and interactions (likes, comments).

  2. 2

    Explain the feed generation strategy: push-on-write (fanout to friends' timelines at post time) vs. pull-on-read (assemble feed at read time), and the hybrid approach WeChat likely uses.

  3. 3

    Design the privacy enforcement layer: visibility groups, blocked user filtering, "visible to recent 3 days" time restrictions, all enforced at both write-time fanout and read-time filtering.

  4. 4

    Address the interaction model: how likes and comments are stored and how comment visibility follows the "mutual friends" rule unique to WeChat Moments.

Sample Answer

The backend has four core services. The Post Service handles content storage in a distributed KV store sharded by user ID, with metadata in a relational database for querying. The Social Graph Service maintains bidirectional friend relationships in a graph database, cached in Redis for fast lookups, supporting visibility groups and block lists. The Feed Service uses a hybrid push-pull model: when a user posts, the system fans out to active friends' timeline caches (push), but for users with many friends or inactive users, the feed is assembled on-demand (pull). The timeline is a per-user sorted set in Redis, keyed by timestamp. The Privacy Service is the critical differentiator — it acts as a filter at every read path. Each post has a visibility descriptor: "all friends," "specific groups," "exclude specific friends," or "private." At fanout time, the privacy filter determines which friends receive the post. At read time, it re-validates in case relationships changed. WeChat Moments' unique comment visibility rule — you can only see comments from mutual friends — requires an intersection query on the social graph for each comment, which is pre-computed and cached. For the "visible to recent 3 days" feature, posts have a TTL in the timeline cache but remain in permanent storage for the author.

Pro Tips

  • Emphasize the privacy model as the core architectural challenge — this is what makes Moments fundamentally different from public feeds like Twitter or Instagram.

  • Discuss the mutual-friends comment visibility rule specifically — it's a unique and complex requirement that shows you understand WeChat deeply.

  • Address the scalability of fanout: how to handle users with thousands of friends without creating write amplification storms.

Frequently Asked Questions

Why does WeChat Moments use a friend-only model instead of public feeds?

The friend-only model creates a safer, more intimate sharing environment that encourages higher-quality personal posts. It aligns with Chinese social norms around privacy and relationship boundaries. This design choice is deliberate and central to Moments' sustained engagement over a decade.

How do you handle the feed for users with thousands of friends?

For high-fan-out users (celebrities or social butterflies), full push-on-write is too expensive. The system switches to a pull-based model for these users: their posts are stored centrally, and followers' feeds pull and merge them at read time. A threshold (e.g., 500 friends) determines which model applies.

Worried About Going Blank in Your Interview?

HireMe AI listens to your interview in real-time, detects questions, and generates instant answer suggestions — so you never freeze up again.

Try HireMe AI Free