Step 1: Requirements
Requirements
Questions to ask
- How is the feed ranked? Chronological, algorithmic, or both?
- What content types? (text, image, video, link, poll)
- How does following work? (follow users, follow topics?)
- Do we need real-time updates (new posts appear live)?
- What is the pagination strategy? (cursor-based? offset?)
- Do we need post interactions (like, comment, share)?
Functional requirements
- User creates posts of various types
- User follows/unfollows other users
- Feed shows posts from followed users, ranked by algorithm
- Paginate feed efficiently (cursor-based)
- Notify followers when a user posts
- Support likes and comments
Non-functional requirements
- Feed generation < 200ms for the first page
- Support users following thousands of accounts
- Recent posts prioritized; old posts eventually drop off
- Read-heavy (1000:1 read-to-write ratio)