Mobile System Design and API Design of YouTube
Understand how YouTube's mobile app architecture integrates MVVM-C, caching strategies, and a Backend for Frontend layer to deliver seamless playback and personalized feeds. Learn about API design supporting playback, search, rating, and comments in a resource-constrained mobile environment.
In the previous lesson, we defined key design considerations such as MVVM-C architecture, playback state management, caching strategies, and life cycle handling. In this lesson, we translate those decisions into a concrete mobile System Design.
We will first explore the high-level System Design, then zoom into detailed mobile components, and finally define the API endpoints and data models that power feed retrieval, playback, search, and user interactions.
High-level mobile System Design
When a user opens the YouTube mobile app, the View layer renders the video feed and delegates user actions such as pull-to-refresh, thumbnail taps, and search queries to the ViewModel. The ViewModel invokes the Repository layer, which checks the local data source first. This local source includes disk-cached feed metadata and a segment cache for recently watched videos. If the local cache cannot satisfy the request, the Repository falls back to the remote data source via the
BFF and back-end routing
The BFF aggregates calls to the video metadata service, recommendation engine, and CDN manifest resolver into a single mobile-optimized response. It trims unnecessary fields like full creator analytics or desktop-specific layout data that would waste bandwidth on a mobile device. The BFF forwards requests through the API gateway, which handles authentication, rate limiting, and request routing to backend microservices.
The response flows back through the same chain. The ViewModel updates observable state, and the View renders the feed or initiates playback. This mirrors the MVVM-C pattern established previously but now shows concrete ...