Design 24-Hour Ephemeral Stories for a Photo and Video Sharing App
Company: Meta
Role: Software Engineer
Category: System Design
Difficulty: medium
Interview Round: Onsite
Design the stories feature of a photo- and video-sharing app. Users post photos or short videos as stories that their followers can view for 24 hours, after which the stories disappear. At the top of the app, each user sees a tray of followed accounts that have stories they have not watched yet; tapping an account plays that account's active stories in order.
```hint What happens at the deadline
Think about what must be true exactly at the 24-hour mark and what can safely happen later in the background.
```
```hint The tray is the hot path
The tray loads on every app open; think about what it needs to know per followed account and how small that can be.
```
### Constraints and Clarifications
- Media processing (transcoding, thumbnails) and a CDN can be assumed to exist as building blocks; design how the feature uses them.
- Scale and latency targets are not given; ask for them or state assumptions.
### Clarifying Questions
- How many daily active users are there, how many stories are posted per day, and what are the typical and largest follower counts?
- Can authors see who viewed each story, and must view counts be exact?
- Are restricted audiences, such as a close-friends list, in scope?
- What are the maximum video length and the supported upload formats?
- Must "watched" state sync across a viewer's devices?
### What a Strong Answer Covers
- The upload path for media: direct-to-storage upload, processing, and CDN delivery
- Building the tray: which followed accounts have active unwatched stories, and in what order
- Expiry semantics and how expired content is cleaned up
- Tracking watched state per viewer and viewer lists per story
- Handling authors with very large followings on both the tray and viewer-list paths
- Enforcing audience restrictions and blocks
- Prefetching for smooth playback
### Follow-up Questions
- How would you rank the accounts in the tray?
- An account with a very large following posts a story. What load does that create for tray updates and for viewer-list writes?
- How would you let authors keep selected stories visible on their profile beyond 24 hours?
- How do you guarantee an expired story is never shown, even when some caches are stale?
Overview: A system design question on ephemeral stories that followers can view for 24 hours before they disappear, covering media upload, the tray of accounts with unwatched stories, playback, and viewer tracking. It tests expiry semantics, fan-out for popular authors, watched-state storage, and media delivery.