React Native

Feeds 101

LAST EDIT Oct 01 2024

Here we will explain some high-level overview of some of the key concepts associated with activity feeds.

Feeds

Copied!

A Feed is like a Stack (FILO) of activities. Activities can be pushed directly to a Feed. They can also be propagated from feeds that they follow (see: “Follow Relationships” and “Fan-out”). A single application may have multiple feeds. For example, you might have a user's feed (what they posted), their timeline feed (what the people they follow posted), and a notification feed (to alert them of engagement with activities they posted).

Most activity feeds people think of are “flat” feeds. These are your classic “timeline” feeds. There are also aggregated feeds and notification feeds, but we will get to those a bit later.

Activities

Copied!

Activities are the content that appear within a feed. Posts on Instagram, tweets on Twitter, workouts on Strava, or posts on Facebook are all examples of activities.   In short, activities are the core building block of your feed. 

Activities require three pieces of information: an actor, a verb, and an object. The actor is the entity performing the action. The verb is the type of action. The object is the content of the activity itself (often a reference). For example, replicating a Twitter post in Feeds, might look something like this:

  • Actor: “Joe”

  • Verb: “tweet”

  • Object: “tweet_id:1268”

Reactions

Copied!

Reactions are how users engage with activities they did not create themselves. You can think of these as ways to interact with the activity without altering the content of the activity itself. Some common social media reactions are: likes, hearts, and retweets. Comments are also a form of reaction. Reactions are always tied to an activity.

Follow Relationships

Copied!

Feeds can follow each other. When a feed follows another, activities from the followed feed will appear in the follower’s feed. This concept is called “fan out”. A “follow” relationship is one-way. If Feed A follows Feed B, then Feed B’s activities will appear in Feed A, but Feed A’s activities will not appear in Feed B.

Fan-out

Copied!

Fan-out refers to propagating activities from the feed they were originally posted in to the feeds that follow it. Fan out is only 1 layer deep, meaning a feed has to directly follow another feed in order to have their activities fanned out to them. 

For example, say Feed B follows Feed A, and Feed C follows Feed B, but Feed C does not directly follow Feed A. When an activity is added to Feed A, it will appear in Feed B, but it will not appear in Feed C.

Fan-out diagram
Activities posted in one feed are also propagated to the feeds that follow it.

This has implications for deleting activities as well. In this example, if the original activity is deleted from Feed B, then it is also deleted from Feed C. However, if it is just deleted from Feed C, the origin activity will still appear in Feed B. (Note: Following feeds that follow other feeds, like Feed C in this example, is typically a "code smell" and not recommended.)

If you would like an activity to appear in a feed that does not follow the one you are adding the activity to, you can "target" the activity to that feed using the the to field. An example of this would be a hashtag feed. For more information on targeting, see Targeting with the TO field in the Best Practices section. Activities that are added to a feed via targeting will fan out to feeds that follow the targeted feed. However, if you add activities to many feeds at once using AddToMany, they will not fan out. 

Fan out is a critical piece of functionality for activity feeds. This feature is how you can see all of the posts for people you follow on your social media in your timeline feed.