Requirements
Functional Requirements:
- Allow users to tweet messages up to 140 characters.
- Enable users to follow other users.
- Allow users to like tweets from other users.
- Display tweets from followed users in the home feed.
- Show top K popular tweets in the home feed based on likes and followers.
Non-Functional Requirements:
- List the key non-functional requirements (eg low latency, scalability, reliability, etc.)...
Capacity Estimation
Estimate the scale of the system. Consider daily active users, read/write ratio, storage requirements, bandwidth, and any relevant QPS calculations...
API Design
Tweet:
ADD /tweet/v1/
GET /tweet/v1/tid
POST(modification) /tweet/v1/tid
Delete /tweet/v1/tid
Like:
GET /tweet/v1/tid
POST /tweet/v1/tid
Follower:
LIST /follower/v1/uid
ADD /follower/v1/uid
Workflow:
- Client login to Auth server
- A token is assigned for login afterward
- Login into server, checking below information in cache
- Followers
- Top Feeds in last 5 minutes
- If hit, just sent to client. Else fetch from Database then update Cache
Database Design
Define the data model. Identify the main entities, their attributes, and relationships. Consider the choice of database type (SQL vs NoSQL) and justify your decision based on access patterns...