DEV Community

Discussion on: Build an Instagram clone with strapi.js and svelte (PART 2)

Collapse
 
arnu515 profile image
arnu515

You could create a followers table in the database, which would contain the user it belongs to, and users they follow as relationships. This will allow you to get the Followers and Following numbers you see on instagram.

For the frontend, you could setup a custom filter which would show, for example, only the posts of the people the user followed.

Collapse
 
siemensubbaiah profile image
siemen_subbaiah

Hey there, I know it is a super late reply!
but can you elaborate here, I'm primarily a frontend dev!

Thread Thread
 
arnu515 profile image
arnu515

No worries! Strapi makes it really easy for you.

You need to create a table called "followers" which will basically act as a link between two users - a user who is following another user. This kind of relationship is called a Many-to-Many relationship, which means that many users can follow many other users. While creating a relationship, you can select the many-to-many option and choose the tables in strapi itself.