Frontend system design · about 45 minutes
News feed with infinite scroll
Design the home feed of a social product. The feed shows posts from people the user follows. A post has text, optional images, an author, a like count and a comment count. The user scrolls without an end, can like a post, and can write a new post. New posts arrive while the feed is open. Most users are on phones, and many have a slow network.
Ask first
- Is the order by time, or does the server rank the posts? Can the order change between requests?
- What can a post contain: text only, images, video, links?
- Do new posts appear at once, or behind a button such as 'Show 5 new posts'?
- Must like counts be live for everyone, or only correct after my own action?
- Do we need server rendering for the first load, for speed or for search engines?
- Must the feed keep its position when the user opens a post and comes back?
The outline
Write your own outline for each part first.
The strong answer, the pitfalls and the follow-ups opens with a year in the app. What a year includes