Knowledge Guide
HomeOO & Low-Level DesignOO Design Problems

Design LinkedIn

Let's design LinkedIn.

LinkedIn is a social network for professionals. The main goal of the site is to enable its members to connect with people they know and trust professionally, as well as to find new opportunities to grow their careers.

A LinkedIn member’s profile page, which emphasizes their skills, employment history, and education, has professional network news feeds with customizable modules.

LinkedIn is very similar to Facebook in terms of its layout and design. These features are more specialized because they cater to professionals, but in general, if you know how to use Facebook or any other similar social network, LinkedIn is somewhat comparable.

Image
Image

System Requirements

We will focus on the following set of requirements while designing LinkedIn:

  1. Each member should be able to add information about their basic profile, experiences, education, skills, and accomplishments.

  2. Any user of our system should be able to search for other members or companies by their name.

  3. Members should be able to send or accept connection requests from other members.

  4. Any member will be able to request a recommendation from other members.

  5. The system should be able to show basic stats about a profile, like the number of profile views, the total number of connections, and the total number of search appearances of the profile.

  6. Members should be able to create new posts to share with their connections.

  7. Members should be able to add comments to posts, as well as like or share a post or comment.

  8. Any member should be able to send messages to other members.

  9. The system should send a notification to a member whenever there is a new message, connection invitation or a comment on their post.

  10. Members will be able to create a page for a Company and add job postings.

  11. Members should be able to create groups and join any group they like.

  12. Members should be able to follow other members or companies.

Use case diagram

We have three main Actors in our system:

Here are the top use cases of our system:

Image
Image

Class diagram

Here are the main classes of the LinkedIn system:

Image
Image
Image
Image

Activity diagrams

Add experience to profile: Any LinkedIn member can perform this activity. Here are the steps to add experience to a member profile:

Image
Image

Send message: Any Member can perform this activity. After sending a message, the system needs to send a notification to all the requested members. Here are the steps for sending a message:

Image
Image

Code

Here is the high-level definition for the classes described above:

Enums, data types, and constants: Here are the required enums, data types, and constants:

java
public enum ConnectionInvitationStatus {
    PENDING, ACCEPTED, CONFIRMED, REJECTED, CANCELED
}

public enum AccountStatus {
    ACTIVE, BLOCKED, BANNED, COMPROMISED, ARCHIVED, UNKNOWN
}

public class Address {
    private String streetAddress;
    private String city;
    private String state;
    private String zipCode;
    private String country;
}

Account, Person, Member, and Admin: These classes represent the different people that interact with our system:

java
// For simplicity, we are not defining getter and setter functions. The reader can
// assume that all class attributes are private and accessed through their respective
// public getter method and modified only through their public setter method.

public class Account {
    private String id;
    private String password;
    private AccountStatus status;

    public boolean resetPassword();
}

public abstract class Person {
    private String name;
    private Address address;
    private String email;
    private String phone;

    private Account account;
}

public class Member extends Person {
    private Date dateOfMembership;
    private String headline;
    private byte[] photo;
    private List<Member> memberSuggestions;
    private List<Member> memberFollows;
    private List<Member> memberConnections;
    private List<Company> companyFollows;
    private List<Group> groupFollows;
    private Profile profile;

    public boolean sendMessage(Message message);

    public boolean createPost(Post post);

    public boolean sendConnectionInvitation(ConnectionInvitation invitation);
}

public class Admin extends Person {
    public boolean blockUser(Customer customer);

    public boolean unblockUser(Customer customer);
}

Profile, Experience, etc: A member's profile will have their job experiences, educations, skills, etc:

java
public class Profile {
    private String summary;
    private List<Experience> experiences;
    private List<Education> educations;
    private List<Skill> skills;
    private List<Accomplishment> accomplishments;
    private List<Recommendation> recommendations;
    private List<Stat> stats;

    public boolean addExperience(Experience experience);

    public boolean addEducation(Education education);

    public boolean addSkill(Skill skill);

    public boolean addAccomplishment(Accomplishment accomplishment);

    public boolean addRecommendation(Recommendation recommendation);
}

public class Experience {
    private String title;
    private String company;
    private String location;
    private Date from;
    private Date to;
    private String description;
}

Company and JobPosting: Companies can have multiple job postings:

java
public class Company {
    private String name;
    private String description;
    private String type;
    private int companySize;

    private List<JobPosting> activeJobPostings;
}

public class JobPosting {
    private Date dateOfPosting;
    private String description;
    private String employmentType;
    private String location;
    private boolean isFulfilled;
}

Group, Post, and Message: Members can create posts, send messages, and join groups:

java
public class Group {
    private String name;
    private String description;
    private int totalMembers;
    private List<Member> members;

    public boolean addMember(Member member);

    public boolean updateDescription(String description);
}

public class Post {
    private String text;
    private int totalLikes;
    private int totalShares;
    private Member owner;
}

public class Message {
    private Member[] sentTo;
    private String messageBody;
    private byte[] media;
}

Search interface and SearchIndex: SearchIndex will implement the Search interface to facilitate searching for members, companies and job postings:

java
public interface Search {
    public List<Member> searchMember(String name);
    public List<Company> searchCompany(String name);
    public List<JobPosting> searchJob(String title);
}

public class SearchIndex implements Search {
    private HashMap<String, List<Mamber>> memberNames;
    private HashMap<String, List<Company>> companyNames;
    private HashMap<String, List<JobPosting>> jobTitles;

    public List<Member> searchMember(String query) {
        return memberNames.get(query);
    }

    public List<Company> searchCompany(String query) {
        return companyNames.get(query);
    }

    public List<JobPosting> searchJob(String query) {
        return jobTitles.get(query);
    }
}
🤖 Don't fully get this? Learn it with Claude

Stuck on Design LinkedIn? Open Claude, copy a block below, and it'll teach you this exact concept — visually and interactively.

🎨 Explain it visually

Build the mental picture, not memorization.

I just read a lesson on **Design LinkedIn** (OO & Low-Level Design) and want to truly understand it. Explain Design LinkedIn from first principles using ONE vivid real-world analogy and a visual mental model — draw it as ASCII art or a clear step-by-step diagram — with a concrete example using real numbers. Then ask me one question to check I got the mental picture, and wait for my reply. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🤔 Walk me through it (interactive)

Socratic — adapts to where you're stuck.

Teach me **Design LinkedIn** interactively. Ask me ONE guiding question at a time, wait for my answer, and adapt to my confusion — build the idea with me step by step instead of explaining it all at once. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🧪 Quiz me & fix my gaps

Active recall exposes what you missed.

Quiz me on **Design LinkedIn** with 5 questions, easy to tricky, ONE at a time. Tell me if each answer is right; at the end, explain clearly what I got wrong and why. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🧠 Make it stick

Intuition + hook + flashcards for long-term memory.

Help me remember **Design LinkedIn** for the long term: give the one-sentence intuition, a memorable hook/mnemonic, a tiny worked example, and 3 active-recall flashcards (Q -> A). If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.

📝 My notes