← Lessons

quiz vs the machine

Platinum1740

System Design

The Activity Stream Model

Representing feed events as actor verb object so many activity types share one pipeline.

5 min read · advanced · beat Platinum to climb

A common shape for events

Feeds carry more than posts. They carry likes, follows, comments, and shares. The activity stream model gives all of them one shape so a single pipeline can handle every type.

Each event is an activity with a few parts:

  • An actor, who did it.
  • A verb, what they did, such as posted, liked, or followed.
  • An object, what they acted on, such as a photo or a comment.
  • An optional target, where it happened, and a timestamp.

So a like becomes actor likes object, and a post becomes actor posts object. One uniform record.

Why this helps

  • New activity types need no new pipeline, just a new verb.
  • Feeds, notifications, and timelines all read the same activity records.
  • Aggregation is natural. Many likes on one object collapse into one summarized activity, three people liked your photo.

The tradeoff

The model is general, so clients must know how to render each verb. The system stores structured activities and leaves presentation to the surface that displays them.

Key idea

The activity stream model records each event as actor verb object so many activity types flow through one pipeline and aggregate naturally into summaries.

Check yourself

Answer to earn rating on the learn ladder.

1. What are the core parts of an activity?

2. What is a key benefit of the activity stream model?

3. How does the model enable aggregation?