System design · HLD
FB News Feed
Core Requirements
- Users should be able to create posts.
- Users should be able to friend/follow people.
- Users should be able to view a feed of posts from people they follow, in reverse chronological order (newest first).
- Users should be able to page through their feed.
Non functional
1.view post should be available , can tolerate 1min of low consistency
2.posting and view page should be low latency (<500ms)
3. Handle DAU 2B
4.user should be follow unlimited number of users and followed back
core entiites
user - stroe user anme , desc, detail etc
post - postid , userid , created at
follow - following , follower
Api
//create a post
POST /posts ->postid
{
"Content" :
}
// follow people
PUT /users/[id]/follow
{} — to handle idempotency , if a user multiple try to follow a different person - 1 single follow should be counted
//get feed
GET /feed?pageSize={pagesize}&cursor={timestamp?}