LinkedIn: low-level design

Design the core of a professional network. Members build profiles, connect with others, post updates, and apply to jobs. Companies post jobs and review applicants.

Stage 1: Members, profiles and connections

Model who people are and how they connect.

Connection is two-way and profile fields have visibility. A `Connection` is one record naming two members. A `Profile` belongs to one member and carries a visibility setting. One record means both sides always agree. 'Who are my connections?' needs an index on both sides of the record.

Stage 2: Companies, jobs and applications

Add the hiring side.

Jobs and applications need owners, and one member should apply once. A `Company` owns its `Job`s and an `Application` links a member to a job. Applying checks that no application exists for that pair. The (job, applicant) pair is unique, so duplicates are impossible. A unique constraint in the data store is the real guarantee; the check is for a friendly message.

Stage 3: Application stages: State

Move applicants through the pipeline.

A recruiter should not offer a job to someone not yet interviewed. `ApplicationState` decides what comes next. Screening can go to interview or reject; interview to offer or reject; an offer is final. Legal moves are encoded in states, not checked in UI code (**State**). Each concrete state is a small class (Screening, Interview, Offer, Rejected). They are listed as one box to keep the diagram readable.

Stage 4: Recommendations, search and notifications

Keep discovery apart from the core.

Discovery code (search, suggestions) and notifications must not leak into the core models. `Recommender` with `PeopleYouMayKnow` (friends of friends) as the first policy. `SearchService` owns the indexes. `Notifier` reacts to events. A better recommender is a new class (**Strategy**), and the core models stay unchanged. Recommendations are computed offline and cached. Showing a stale suggestion is fine; blocking a page is not.