Library / Blogs
Xero Blog
The API & app developer programs for global small business platform, Xero. developer.xero.com
By Xero engineers · Xero · Added 2026-10-12
All content belongs to Xero engineers / Xero. We only link to it and give credit. Report a problem
Learn this article
About 37 min left. Your work is saved as you go.
What you are about to study
Xero wrote this to explain how they thought about a problem. You should know the basics: caching, queues and replication.
Ideas you will meet
- Distributed Systems
- Consensus, time, failure and the fundamentals of scale-out.
What we already know about this
Our own lessons on these ideas. Read them here before you start, so it makes sense.
Low-Level Design Practice · 10 minVideo catalogue (Netflix-style)Titles, profiles, playback and recommendations: modelling content, per-profile state and a swappable recommendation strategy.Read here
The problem
Subscribers have accounts with several profiles. They browse a catalogue of movies and series, play titles, resume where they stopped, and see recommendations. This lesson models the domain. The streaming infrastructure (transcoding, CDN) is in the video-streaming lesson of the classic designs course.
Entities
100%Figure SDA-LLD-16-1 · Video catalogue classes · © forcsguy.com
A playable unit is a movie or an episode; the player only needs an asset id and a duration.
Playback and resume
100%Figure SDA-LLD-16-2 · Playback state · © forcsguy.com
class Player { state: "STOPPED" | "PLAYING" | "PAUSED" | "FINISHED" = "STOPPED"; constructor(private profile: Profile, private progress: ProgressStore) {} play(unit: Playable) { if (!canPlay(this.profile, unit)) throw new Error("not allowed"); // rating and plan rules, one place this.state = "PLAYING"; this.seek(this.progress.get(this.profile.id, unit.id) ?? 0); } tick(unit: Playable, pos: number) { this.progress.save(this.profile.id, unit.id, pos); // every few seconds, not every frame if (pos >= unit.duration * 0.95) this.state = "FINISHED"; } }Recommendations as a strategy
interface Recommender { forProfile(p: Profile, n: number): Title[] } const popularInGenre: Recommender = { forProfile: (p, n) => catalog.byGenres(topGenresOf(p)).filter(t => !watched(p, t) && allowed(p, t)).sort(byPopularity).slice(0, n), };Start with a simple strategy (popular in the genres you watch, not yet seen, allowed for the profile). Replace it later with collaborative or learned models behind the same interface.
Design notes
- One rule for access:
canPlayandallowedcombine plan limits, region licensing, maturity rating and device limits, and are used everywhere. - Concurrent streams: the plan limits simultaneous streams; track active sessions and refuse extra ones with a clear message.
- Progress writes are frequent and approximate; buffer and save periodically, and let the latest write win.
- Catalogue changes (titles added or removed by region and date) are data, not code.
- Extensions: downloads, parental controls, ratings, search, and "because you watched" rows.
Real-world reading
Related reading
- ByteByteGo: System Design Video SeriesAlex Xu · ByteByteGoYouTube
- Performance Optimization on Image, Video, Page LoadGoogle engineers · GoogleCase Studies
- Netflix: What Happens When You Press Play?High Scalability engineers · High ScalabilityBlogs
- SVE: Distributed Video Processing at Facebook Scale (paper)Huang et al. · Facebook ScalePapers
Show 6 moreShow fewer
- CS Video CoursesDeveloper-Y · GitHubGitHub
- Deterministic Aperture: A Distributed, Load Balancing Algorithm at TwitterTwitter engineers · TwitterCase Studies
- The Google File System (paper)Ghemawat, Gobioff and Leung · GooglePapers
- Aroma: Using ML for Code Recommendation at FacebookFacebook engineers · FacebookCase Studies
- Wealthfront Engineering BlogWealthfront engineers · WealthfrontBlogs
- Xero BlogXero engineers · XeroBlogs
- One rule for access:
Go deeper on this
A path through videos, articles, other case studies and code on the same ideas as Xero Blog.
Warm upGet the vocabulary first.
Books · Free from the author
Concurrent and Distributed Systems (Cambridge lecture notes)
Eight lectures on time, broadcast, replication, consensus and transactions, with notes, slides and video. Free from the author under CC BY-SA.
University of CambridgeIntermediate
Books · Free from the author
Computer Networks: A Systems Approach
How networks are built and why: protocols, routing, congestion control and the internet's architecture. The authors publish it free online under CC BY 4.0.
Systems ApproachIntermediate
WatchHow others solve the same problem, on video.
Videos belong to their creators and play from YouTube. More on YouTube (opens in a new tab)
ReadEngineers explain it in their own words.
Blogs · Free from the author · Read here
Scalable Web Architecture and Distributed Systems
A full chapter on the building blocks of large websites: availability, performance, reliability, scalability, caches, proxies, indexes, load balancers and queues. Free to read here under CC BY 3.0.
The Architecture of Open Source ApplicationsBeginner40 min
Papers · Read here
Facebook’s photo storage
This paper describes Haystack, an object storage system optimized for Facebook’s Photos application. Facebook currently stores over 260 billion images, which translates to over 20 petabytes of data.
USENIXIntermediate
See it in another companyThe same ideas, a different system.
Case Studies · Read here
Aroma: Using ML for Code Recommendation at Facebook
Thousands of engineers write the code to create our apps, which serve billions of people worldwide. This is no trivial task—our services have grown so diverse and complex that the codebase contains…
FacebookIntermediate
Case Studies · Read here
Brooklin: Distributed Service for Near Real-Time Data Streaming at LinkedIn
Brooklin—a distributed service for streaming data in near real-time and at scale—has been running in production at LinkedIn since 2016, powering thousands of data streams and over 2 trillion messages per day. Today, w...
LinkedInIntermediate
Read the codeSee how it looks when it is real.
GitHub
Engineering Blogs
A huge directory of company engineering blogs to learn from real production systems.
kilimchoiIntermediate
GitHub
Awesome Scalability
Curated reading list of articles on the architecture of scalable, reliable systems.
binhnguyennusIntermediate
Keep learning
Loading community…