Design a Music Streaming Service Like Spotify with Uploads, Search, Recommendations and Royalties

Quick Overview

Design a music streaming service where artists upload high-resolution tracks and listeners stream them with quality that adapts to their network, search the catalog, and get recommendations. It tests storage and CDN choices, event pipelines, search indexing, and accurate counting of listens for royalty payments.

Design a Music Streaming Service Like Spotify with Uploads, Search, Recommendations and Royalties

Role: Software Engineer

Category: System Design

Difficulty: hard

Interview Round: Other

Design a music streaming service similar to Spotify. The system should let users stream, search, and upload songs. It must meet these functional requirements: 1. Artists can upload high-resolution audio and manage the metadata of their tracks. 2. Users can play music, with audio quality that adapts to their network. 3. Users get sub-second fuzzy search across artists, albums, and tracks. 4. A machine learning system recommends songs that each user is likely to enjoy. 5. The service tracks "valid" listens accurately so that royalty payments can be disbursed. Work through the non-functional requirements, a data model, the API, and a high-level design. Then go deeper on three areas: adaptive bitrate streaming together with keeping search in sync, the recommendation pipeline, and royalty tracking. ```hint Split the system Uploading and processing a track has very different latency and availability needs from playing one. Design them as separate paths and decide which one can be asynchronous. ``` ```hint Size the playback traffic Estimate how many bytes per second playback needs at your user count. That number tells you which component should serve the audio. ``` ```hint Money needs exact counts Heartbeats get retried, arrive late, and sometimes come from bots. Ask what happens to a royalty total in each of those cases. ``` ### Constraints & Assumptions - Example non-functional requirements to start from: availability over consistency, page loads under 300 ms, and 99.9% uptime. - That list is incomplete. Propose the remaining requirements yourself, including scale targets and how quickly playback must start. ### Clarifying Questions to Ask - How many daily active users and how many tracks should the design support, and in which regions? - Which audio qualities must playback offer (compressed only, or lossless too), and on which kinds of clients? - What counts as a valid listen for royalties, and how often are payouts calculated? - How fresh must recommendations be? Is a nightly refresh acceptable, or should they react to the current listening session? - Do tracks need DRM protection or region-based licensing restrictions? ### What a Strong Answer Covers - Non-functional requirements with concrete numbers (scale, time to first audio, availability for each path) and a rough estimate of storage, playback bandwidth, and event volume. - A data model and a choice of store for each kind of data: catalog metadata, audio files, the search index, user activity, and the royalty ledger. - An upload path that turns a high-resolution master into audio that plays well on weak networks, and a playback path that meets the latency target worldwide. - How the search index stays consistent with the catalog, and how recommendations combine long-term listening history with recent behavior. - How valid listens are counted for royalties without loss or double counting when clients retry, and how bot traffic is kept out of payouts. ### Follow-up Questions - A major artist releases an album at midnight and millions of users request the same few tracks at once. What breaks first, and how do you prepare for it? - How would you add offline downloads while still enforcing licensing rules and counting plays for royalties? - Most of the catalog is rarely played. How do you keep storage costs down without hurting playback latency for those tracks? - How would you make playback gapless between consecutive tracks?

Overview: Design a music streaming service where artists upload high-resolution tracks and listeners stream them with quality that adapts to their network, search the catalog, and get recommendations. It tests storage and CDN choices, event pipelines, search indexing, and accurate counting of listens for royalty payments.

Nov 25, 2026
hardSoftware EngineerOtherSystem Design
0
0

Design a music streaming service similar to Spotify. The system should let users stream, search, and upload songs.

It must meet these functional requirements:

  1. Artists can upload high-resolution audio and manage the metadata of their tracks.
  2. Users can play music, with audio quality that adapts to their network.
  3. Users get sub-second fuzzy search across artists, albums, and tracks.
  4. A machine learning system recommends songs that each user is likely to enjoy.
  5. The service tracks "valid" listens accurately so that royalty payments can be disbursed.

Work through the non-functional requirements, a data model, the API, and a high-level design. Then go deeper on three areas: adaptive bitrate streaming together with keeping search in sync, the recommendation pipeline, and royalty tracking.

Constraints & Assumptions

  • Example non-functional requirements to start from: availability over consistency, page loads under 300 ms, and 99.9% uptime.
  • That list is incomplete. Propose the remaining requirements yourself, including scale targets and how quickly playback must start.

Clarifying Questions to Ask Guidance

  • How many daily active users and how many tracks should the design support, and in which regions?
  • Which audio qualities must playback offer (compressed only, or lossless too), and on which kinds of clients?
  • What counts as a valid listen for royalties, and how often are payouts calculated?
  • How fresh must recommendations be? Is a nightly refresh acceptable, or should they react to the current listening session?
  • Do tracks need DRM protection or region-based licensing restrictions?

What a Strong Answer Covers Guidance

  • Non-functional requirements with concrete numbers (scale, time to first audio, availability for each path) and a rough estimate of storage, playback bandwidth, and event volume.
  • A data model and a choice of store for each kind of data: catalog metadata, audio files, the search index, user activity, and the royalty ledger.
  • An upload path that turns a high-resolution master into audio that plays well on weak networks, and a playback path that meets the latency target worldwide.
  • How the search index stays consistent with the catalog, and how recommendations combine long-term listening history with recent behavior.
  • How valid listens are counted for royalties without loss or double counting when clients retry, and how bot traffic is kept out of payouts.

Follow-up Questions Guidance

  • A major artist releases an album at midnight and millions of users request the same few tracks at once. What breaks first, and how do you prepare for it?
  • How would you add offline downloads while still enforcing licensing rules and counting plays for royalties?
  • Most of the catalog is rarely played. How do you keep storage costs down without hurting playback latency for those tracks?
  • How would you make playback gapless between consecutive tracks?