Video catalogue (Netflix-style)

Titles, profiles, playback and recommendations: modelling content, per-profile state and a swappable recommendation strategy.

On the roadmap:Software Design · step 6: Low-level design: games and apps

Lesson 16 of 16 · 10 min read · quiz · exercise

The problem

Subscribers have accounts with several profiles. They browse a catalogue of movies and series, play titles, resume where they stopped, and see recommendations. This lesson models the domain. The streaming infrastructure (transcoding, CDN) is in the video-streaming lesson of the classic designs course.

Entities

Figure SDA-LLD-16-1 · Video catalogue classes · © forcsguy.com

A playable unit is a movie or an episode; the player only needs an asset id and a duration.

Playback and resume

Figure SDA-LLD-16-2 · Playback state · © forcsguy.com

class Player {
  state: "STOPPED" | "PLAYING" | "PAUSED" | "FINISHED" = "STOPPED";
  constructor(private profile: Profile, private progress: ProgressStore) {}

  play(unit: Playable) {
    if (!canPlay(this.profile, unit)) throw new Error("not allowed");   // rating and plan rules, one place
    this.state = "PLAYING";
    this.seek(this.progress.get(this.profile.id, unit.id) ?? 0);
  }
  tick(unit: Playable, pos: number) {
    this.progress.save(this.profile.id, unit.id, pos);                  // every few seconds, not every frame
    if (pos >= unit.duration * 0.95) this.state = "FINISHED";
  }
}

Recommendations as a strategy

interface Recommender { forProfile(p: Profile, n: number): Title[] }

const popularInGenre: Recommender = {
  forProfile: (p, n) => catalog.byGenres(topGenresOf(p)).filter(t => !watched(p, t) && allowed(p, t)).sort(byPopularity).slice(0, n),
};

Start with a simple strategy (popular in the genres you watch, not yet seen, allowed for the profile). Replace it later with collaborative or learned models behind the same interface.

Design notes

  • One rule for access: canPlay and allowed combine plan limits, region licensing, maturity rating and device limits, and are used everywhere.
  • Concurrent streams: the plan limits simultaneous streams; track active sessions and refuse extra ones with a clear message.
  • Progress writes are frequent and approximate; buffer and save periodically, and let the latest write win.
  • Catalogue changes (titles added or removed by region and date) are data, not code.
  • Extensions: downloads, parental controls, ratings, search, and "because you watched" rows.

Real-world reading

Check your understanding

Question 1 of 3

0 correct so far

Where does 'continue watching' progress belong?

© 2026 forcsguy.com. Original lesson text and diagrams. Books and sites linked above belong to their authors.