Design a Social Network like Facebook
| Difficulty: Medium | Source: awesome-low-level-design |
Requirements
- User registration/authentication
- User profiles with picture, bio, interests
- Friend requests (send, accept, decline)
- Posts with text, images, videos
- Newsfeed in reverse chronological order
- Likes and comments on posts
- Privacy controls
- Notifications (real-time)
- Scalable
Class Diagram

Classes, Interfaces and Enumerations
| Class/Interface | Description |
|---|---|
| User | Id, name, email, password, profile picture, bio, friends, posts |
| Post | Id, user id, content, images, videos, timestamp, likes, comments |
| Comment | Id, user id, post id, content, timestamp |
| Notification | Id, user id, type, content, timestamp |
| NotificationType | Enum: friend request, accepted, like, comment, mention |
| SocialNetworkingService | Singleton; ConcurrentHashMap + CopyOnWriteArrayList |
Design Patterns Used
| Pattern | Application |
|---|---|
| Singleton | SocialNetworkingService provides a single point of access for user management, posts, and notifications |
Code Implementations
| Language | Source Code |
|---|---|
| Java | View on GitHub |
| Python | View on GitHub |
| C++ | View on GitHub |
| C# | View on GitHub |
| Go | View on GitHub |