Problem and Scope
Design a backend system for a short-video mobile app (TikTok-like). The system should allow users to upload short videos (<= 1 min + caption), view a vertically-scrolling feed (personalized + follow feed), and interact with videos (likes, follows, comments). Focus primarily on backend architecture, data model, API design, and scaling to ~1M daily active users (DAU) with high read volume.
Start by confirming the core user journey, exclusions, success criteria, and the constraints that materially affect the architecture.
Requirements to Clarify
A strong answer should establish scope before choosing components.
Functional requirements:
- Upload video + caption
- Serve a per-user feed (personalized + follow stream)
- Like/follow/comment interactions
- Preload top N videos for low startup latency
Non-functional requirements:
- High availability (target ~99.999%)
- Low read latency for feed playback
- Scale to ~1M DAU, burst to 10x
- Efficient storage & CDN-backed delivery for large video blobs
Scale and Capacity
Use the workload to justify storage, partitioning, caching, and reliability decisions. Clarify or challenge these assumptions rather than treating them as unquestionable facts:
- Users: 1,000,000 DAU (assumption)
- Video size: ~5 MB per 1-minute compressed video (H.264)
- Uploads: assume 2 uploads/user/day => 10 MB/day/user
- Daily video ingest: 1,000,000 * 10 MB = 10,000,000 MB = 10 TB/day
- Monthly raw storage (30d): ~300 TB (before redundancy/replication/transcodes)
- Read-heavy: feed reads >> writes; concurrency spikes possible (viral video)
Architecture Discussion
Walk through the important read and write paths, identify ownership boundaries, and explain how the design behaves when dependencies fail. Cover these areas explicitly:
- Resumable upload, validation, transcoding, object storage, and CDN delivery
- Feed candidate generation, ranking, freshness, pagination, and prefetching
- User, follow graph, video metadata, comments, and engagement data models
- Like and view counters, idempotency, aggregation, and eventual consistency
- Viral-video hotspots, cache strategy, fan-out, and regional capacity
- Moderation, recommendation feedback, multi-region operation, and cost controls
Follow-up Questions
Expect the interviewer to test the consequences of your choices. Practise answering these questions with a concrete decision, its benefit, and its cost:
- Are we building mobile clients? (Assume client-agnostic REST/gRPC APIs.)
- Focus: Assess the candidate's answer to "Are we building mobile clients? (Assume client-agnostic REST/gRPC APIs.)" for explicit assumptions, a workable mechanism, failure behavior, and consequential trade-offs.
- Feed type: follow-only or personalized? (Support both; core design will enable personalized recommendations via a precache service.)
- Focus: Assess the candidate's answer to "Feed type: follow-only or personalized? (Support both; core design will enable personalized recommendations via a precache service.)" for explicit assumptions, a workable mechanism, failure behavior, and consequential trade-offs.
- Max video length? (Assume <= 1 minute compressed H.264.)
- Focus: Assess the candidate's answer to "Max video length? (Assume <= 1 minute compressed H.264.)" for explicit assumptions, a workable mechanism, failure behavior, and consequential trade-offs.
- Which interactions matter? (Likes, follows, comments; basic share/forward optional.)
- Focus: Assess the candidate's answer to "Which interactions matter? (Likes, follows, comments; basic share/forward optional.)" for explicit assumptions, a workable mechanism, failure behavior, and consequential trade-offs.
- Recommendation engine: offline batch + online scoring; features from user interactions, video embeddings, collaborative filtering.
- Focus: Assess the candidate's answer to "Recommendation engine: offline batch + online scoring; features from user interactions, video embeddings, collaborative filtering." for explicit assumptions, a workable mechanism, failure behavior, and consequential trade-offs.
- Personalization freshness: how to balance new uploads appearing in feed vs. stability of feed
- Focus: Assess the candidate's answer to "Personalization freshness: how to balance new uploads appearing in feed vs. stability of feed" for explicit assumptions, a workable mechanism, failure behavior, and consequential trade-offs.
- Moderation: automated content moderation (ML) + human review; policy for removed content and cache invalidation
- Focus: Assess the candidate's answer to "Moderation: automated content moderation (ML) + human review; policy for removed content and cache invalidation" for explicit assumptions, a workable mechanism, failure behavior, and consequential trade-offs.
- Multi-region deployment: geo-routing, data residency, replication
- Focus: Assess the candidate's answer to "Multi-region deployment: geo-routing, data residency, replication" for explicit assumptions, a workable mechanism, failure behavior, and consequential trade-offs.
- Analytics & metrics: realtime dashboards, A/B testing, retention tracking
- Focus: Assess the candidate's answer to "Analytics & metrics: realtime dashboards, A/B testing, retention tracking" for explicit assumptions, a workable mechanism, failure behavior, and consequential trade-offs.
- Cost optimization: long-term cold storage, TTLs for inactive videos, transcode on-demand for rarely viewed bitrates
- Focus: Assess the candidate's answer to "Cost optimization: long-term cold storage, TTLs for inactive videos, transcode on-demand for rarely viewed bitrates" for explicit assumptions, a workable mechanism, failure behavior, and consequential trade-offs.
Evaluation Rubric
MockMe evaluates the answer across the following dimensions. A complete answer should connect claims to requirements and explain consequential trade-offs.
- Requirements and scope (15%): Clarifies and prioritizes the required behavior for Upload video + caption; Serve a per-user feed (personalized + follow stream); Like/follow/comment interactions. Establishes the constraints that materially affect Design TikTok, including High availability (target ~99.999%); Low read latency for feed playback. Strong evidence includes Separates the critical path from secondary features and resolves ambiguous requirements before choosing components.
- Architecture and interfaces (20%): Presents coherent ownership boundaries and end-to-end flows covering Resumable upload, validation, transcoding, object storage, and CDN delivery; Feed candidate generation, ranking, freshness, pagination, and prefetching; User, follow graph, video metadata, comments, and engagement data models; Like and view counters, idempotency, aggregation, and eventual. Strong evidence includes Defines interfaces and traces important success, retry, and failure paths across the proposed components.
- Data and scaling (25%): Uses workload assumptions such as Users: 1,000,000 DAU (assumption); Video size: ~5 MB per 1-minute compressed video (H.264) to justify capacity and partitioning decisions. Explains the data, state, or model strategy for Resumable upload, validation, transcoding, object storage, and CDN delivery; Feed candidate generation, ranking, freshness, pagination, and prefetching; User, follow graph, video metadata, comments, and engagement data models. Strong evidence includes Quantifies a dominant workload, identifies the first bottleneck, and explains how the design evolves as that workload grows.
- Reliability, correctness, and safety (20%): Explains concrete failure behavior, recovery, and operational safeguards for Like and view counters, idempotency, aggregation, and eventual consistency; High availability (target ~99.999%). Strong evidence includes States the required correctness or consistency boundary and covers retries, partial failure, observability, and safe degradation.
- Communication and trade-offs (20%): Drives a structured discussion and compares consequential alternatives for Like and view counters, idempotency, aggregation, and eventual consistency; Viral-video hotspots, cache strategy, fan-out, and regional capacity; Moderation, recommendation feedback, multi-region operation, and cost controls. Strong evidence includes Makes assumptions explicit, answers the question asked, and explains both the benefit and cost of major decisions.