Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Subscription News Feed API and Data Model

Design an API-first feed service with explicit follow relationships, relational constraints, stable pagination, and client-compatible contracts.

Problem statement

For this exercise, assume publishers supply immutable article metadata through a publishing API or registered external RSS feeds and users subscribe to publishers, then browse a reverse-chronological feed of articles from their current subscriptions.

Design the HTTP API and relational schema first, including keys, foreign keys, one-to-many and many-to-many relationships, query shape, pagination, and duplicate handling.

Then evolve the design for scale and explain where asynchronous fanout, caching, or a non-relational store helps without weakening the authoritative follow and article contracts. Compare REST and RPC boundaries and show how web and mobile clients can evolve independently.

Full article bodies, ranking, comments, and ad serving are out of scope. For the RSS path, assume administrators register public HTTPS feed URLs for publishers.

Fetch and parse feeds asynchronously, deduplicate repeated entries and retries, and feed accepted article metadata through the same authoritative ingestion and feed-projection path as direct publishes. Design polling state, upstream failures and bounded parsing.

For this exercise, the first accepted metadata for an upstream entry is immutable; later edits and upstream disappearance do not replace or delete that article. RSS feed polling and these lifecycle conventions are practice assumptions used to make the reported aggregator exercise concrete.

What to build

  1. Subscribe to or unsubscribe from one publisher idempotently.
  2. Publish immutable article metadata with an idempotent client request identifier.
  3. Read a deduplicated reverse-chronological page containing only articles from the user's current subscriptions.
  4. Support independently versioned web and mobile clients through stable external contracts.
  5. Ingest article metadata from registered public HTTPS RSS feeds asynchronously, identify repeated upstream entries consistently, and recover from failed fetches and retries without duplicate feed items.

At scale

  • For this exercise, support 20 million users, 500,000 publishers, up to 5,000 subscriptions per user, and a highly skewed publisher with 10 million followers.
  • For this exercise, peak at 5,000 article publishes and 200,000 feed reads per second; p95 first-page reads should complete within 300 ms.
  • For this exercise, article metadata should appear in eligible feeds within 30 seconds at p95, while follow and unfollow changes take effect on the next new page.
  • For this exercise, retain article metadata for one year and use cursor pagination; clients may retry every mutation.
  • For this exercise, up to 100,000 registered RSS URLs target a refetch within 15 minutes while healthy. Conditional requests and failure backoff limit upstream load. The existing 30-second article-to-feed target starts after an article is accepted into this system, not at an unobserved upstream edit.