← Questions

Data model for feed posts and shares

0
MetaSystem designLast asked Dec 2025

A system design interview question asked in Meta's system design round, last asked Dec 2025. It tests data modeling, data engineering and feeds.

Design the data model behind a social app's news feed. The feed shows several content types (text, image, short video), and users view, like, comment on and share content. Model the transactional entities first, then the analytics warehouse tables.

Requirements

  • Functional: model users, content of every type, and the interactions between users and content (view, like, comment, share).
  • Functional: name the entities, their relationships, and the primary and foreign keys.
  • Functional: in a warehouse, say which tables are dimensions and which are facts, and list their core fields.
  • Functional: answer analytics questions such as daily engagement per content type and how far a post spreads through shares.
  • Non-functional: billions of interaction events a day. The fact tables must be partitioned and cheap to query by date.

Clarifying questions

  • Does a share create new content (a reshare with its own caption) or only an event?
  • Who can a user share to: another user, a group, an external channel?
  • Should the model handle an edited or deleted post, and keep its history?
  • Is a view logged per impression or once per user per post?
  • Which questions must the warehouse answer fast, and how fresh must the answers be?

What a strong answer covers

  • Core entities: user, content (one table with a content_type, plus per-type detail or a media table), comment and interaction, with keys and cardinalities stated.
  • Warehouse dimensions such as dim_user, dim_content and dim_date. Facts at a stated grain: fct_interaction (one row per user, content, action and time) or a separate fact per action type, partitioned by date.
  • Choosing between one wide interaction fact with an action_type column and narrow facts per action, decided against the main queries.
  • Slowly changing attributes, such as a user's country or a post's visibility, kept as type 2 dimensions where history matters.
  • Sharing modeled as fct_share(share_id, sharer_id, content_id, parent_share_id, target_type, target_id, shared_at). parent_share_id lets you walk a share tree and measure depth and reach.

Follow-ups

  • Extend the model to sharing to another user, to a group and to an external channel.
  • Write the query for the number of unique users reached by a post, including reshares of reshares.
  • How do you keep the share tree queryable when one viral post has millions of descendants?
  • A content type is added (live video). What changes in the model?

Where it's asked

  • Meta · System design · Last asked Dec 202545 min · Design discussion; either an LLM-agent system or a classic product system · Nominally AI-enabled, but the assistant is often not used

What it tests

data modeling · data engineering · feeds

Your canvas
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing