Post: Create, view, delete posts, including images and videos.
Timeline: View a feed of posts from followed users.
Social interactions: Like, comment, repost, and reply.
Follow: Follow and unfollow users.
Search: Search users, posts, and hashtags.
Notifications: Notify users about likes, comments, and new followers.
Scalability (major): Handle millions of users and billions of posts.
Low latency (major): Load timelines quickly, ideally within 200 ms server-side.
High availability (major): Target 99.99% availability for reading timelines.
Consistency (minor): Likes and timeline updates can be eventually consistent.
Durability (major): Never lose published posts.
Security (major): Authentication, authorization, and rate limiting.
For peak traffic, assume 3× the average: approximately 21,000 writes/sec and 1.05 million reads/sec.
| Method | Endpoint | Description |
POST | /v1/posts | Create a post |
GET | /v1/posts/{postId} | Get a post |
DELETE | /v1/posts/{postId} | Delete a post |
GET | /v1/timeline?cursor=abc&limit=20 | Get home timeline |
POST | /v1/users/{userId}/follow | Follow a user |
DELETE | /v1/users/{userId}/follow | Unfollow a user |
POST | /v1/posts/{postId}/likes | Like a post |
DELETE | /v1/posts/{postId}/likes | Unlike a post |
GET | /v1/search?q=java | Search posts and users |
GET | /v1/notifications | Get notifications |
Describe the overall system architecture. Identify the main components needed to solve the problem end-to-end. Use the diagramming tool to create a block diagram.
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...
i would choose sql data base, becase i need the tansactional queries and we have relations between the tables, and we need the relation between tables.
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.