Design a Cursor-Paginated Watchlist API That Survives Inserts
Last updated: November 29, 2026
Quick Overview
Design and implement a list endpoint for a Disney+ profile's watchlist that returns items newest first in pages, using an opaque cursor so items added between requests never cause duplicates or skipped titles.
Disney
November 29, 20260
0
0 solved
Design and implement a list endpoint for a Disney+ profile's watchlist that returns items newest first in pages, using an opaque cursor so items added between requests never cause duplicates or skipped titles.
An API design question in the style of Disney Streaming phone screens, built around the My Stuff watchlist on Disney+. The interviewer checks why offset pagination breaks, how a stable sort key and cursor fix it, and basic API hygiene such as limits.
What the Interviewer Expects
- Explain the duplicate and skip problem with offset pagination
- Choose a stable, unique sort key (added_at plus item_id)
- Encode the cursor opaquely so clients do not depend on its format
- Clamp page size and validate the cursor
- Return next_cursor as null at the end
Key Topics to Cover
How to Approach This
- Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
- Choose data structures based on access patterns, not familiarity.
- Prefer immutable data and message passing over shared mutable state for concurrency.
- Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
- How would this query look in SQL with an index?
- How do clients see items added after they started paging?
- How would you version this API without breaking older TV apps?
- What if the user removes an item that was the cursor?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
GET /profiles/{id}/watchlist?limit=20&cursor=... returns {items, next_cursor}. Items are sorted by added_at descending; ties break by item_id ascending so the order is total. Inserts or delete...
High-Level Design
With offset pagination, adding one title at the top shifts every item down, so page 2 repeats the last item of page 1. A keyset cursor instead encodes the sort key of the last item returned, and the n...