#Create a feed system with Appwrite (Fanout system)

9 messages · Page 1 of 1 (latest)

cedar mason
#

Create a feed system with Appwrite (Fanout system)

cedar mason
#

I wanna add a feed system in my nextjs app using Appwrite where I can have the last activity from the user I follow. The problem is HOW TO DO IT. When I look on few exemple (twitter, facebook, etc...) all use FANOUT SYSTEM. With 2 model :

  • push model
  • pull model

So push model is litteraly store a feed for each user. Like having a collection feed in appwrite DB where all document got :

  • userId (target user feed)
  • activityId (id of the activity)
    And pull model is just get the last activity from following user list.

So Twitter, FB, etc.. use hybrid model (push and pull) depending of the amount of following user. That mean if Justin Timberlake with 64M followers, like a movie, we don't gonna use push model because edit 64M feed is to heavy load.

So I guess the push model need an appwrite function who gonna be triggered by the write inside specific collection "likes", "review", etc... and create/delete inside feed collection a new document for a specific userId
And the pull model is gonna be client-side where we gonna request the last activity from the celebrity following user list of the connected user and after merge the them and sort them chronological with the feed (from push model)

cedar mason
#

My first problem is how store differente activity in the feed : movie liked_ movie review, ....
If activityId (attribut inside each document from feed collection) is a relationship attribut I can target to only one collection so im stuck. Maybe use multiple feed collection for each activity likes :

  • feed_movie_liked
  • feed_movie_review
    ....
craggy iris
cedar mason
craggy iris
cedar mason
craggy iris
cedar mason