Asked at
URL Shortener (TinyURL)
Asked from Junior level upFoundations & Storage
Distributed Rate Limiter
Asked from Mid level upAPI Gateway & Security
Distributed Key-Value Store
Asked from Senior level upFoundations & Storage
Distributed Notification Service
Asked from Mid level upMessaging & Queues
Distributed Web Crawler
Asked from Mid level upDistributed Systems
Metrics & Monitoring Platform
Asked from Senior level upObservability & Time-Series
Real-Time Chat App (like WhatsApp or Slack)
Asked from Mid level upReal-Time & WebSockets
Social News Feed (like X/Twitter)
Asked from Mid level upSocial & Feed Systems
Ride-Hailing App (like Uber)
Asked from Senior level upGeospatial & Real-Time
Low-Latency Stock Exchange Matching Engine
Asked from Staff level upFintech & Low Latency
Global Video Streaming Platform (like YouTube or Netflix)
Asked from Senior level upMedia & Streaming
Distributed Hotel & Ticket Reservation System
Asked from Mid level upE-Commerce & Transactions
Shared Document Editor (like Google Docs)
Asked from Staff level upReal-Time & Distributed State
Game Leaderboard
Asked from Junior level upCaching & Data Structures
File Sync Service (Dropbox / Google Drive)
Asked from Mid level upStorage
Payment System
Asked from Senior level upPayments & Transactions
Ad Click Aggregation
Asked from Senior level upStream Processing
AI Support Assistant (RAG)
Asked from Senior level upAI Systems
LLM Inference Platform
Asked from Senior level upAI Systems
Enterprise Semantic Search
Asked from Mid level upAI Systems
AI Code Completion
Asked from Senior level upAI Systems
LLM Gateway
Asked from Senior level upAI Systems
AI Agent That Takes Actions
Asked from Senior level upAI Systems
LLM Evaluation Platform
Asked from Senior level upAI Systems
AI Document Processing Pipeline
Asked from Mid level upAI Systems

Design a File Sync Service (Dropbox / Google Drive)

Asked from Mid level upDomain: Storage
Concepts to know first:

Keep a user's files in sync across laptops and phones, with efficient uploads and a clear rule for conflicting edits.

An analogy

Like a shared binder with numbered pages. When you change one page, you send only that page, and every copy of the binder swaps it in.

Where this design ends up. This is version 3 of 3. Part 5 builds it up from version 1 and says why each part was added.
  1. Clients
    • Your device
    • Other device
  2. Entry
    • CDN
  3. Services
    • Sync service
    • Notification service
  4. Data, outside
    • Metadata database
    • Object storage

1. Requirements and scope

Functional Requirements
  • Upload, download and delete files and folders.
  • Sync changes to all of a user's devices, including after being offline.
  • Share files and folders with other users.
  • Keep version history.
Non-Functional Requirements & SLAs
  • Durability: never lose a committed file.
  • Large uploads survive flaky connections (resumable).
  • Small changes reach other devices within seconds.
  • Send only what changed.
Key Traffic Assumptions: 50 million users, 10 million daily active; an average user stores 10 GB. • Each active user changes about 20 files a day.

2. Back-of-the-envelope numbers

Write Throughput
10M × 20 / 86,400 ≈ 2,300 file changes/s on average
Read Throughput
Millions of devices waiting for changes (long poll or WebSocket); downloads roughly equal uploads
Storage Growth
50M × 10 GB = 500 PB before deduplication; metadata ≈ 50M × 2,000 files × 500 B ≈ 50 TB
RAM Cache Footprint
Recently used folder metadata in Redis: tens of GB

3. API

POST/v1/uploadsStart a resumable upload; returns an upload id and presigned URLs for missing chunks
POST/v1/uploads/{id}/commitCommit a new version: { chunkHashes, baseVersion }
GET/v1/changes?cursor=…Long-poll for changes after a cursor
GET/v1/files/{id}/versionsVersion history

4. Data model and storage

Storage Strategy: Object storage (S3-style) holds file chunks, addressed by content hash. A sharded relational database holds metadata — files, versions, folders, and sharing — sharded by user or shared-folder id.
FILE(id, namespace_id, path, latest_version) · VERSION(file_id, version, chunk_hashes[], size, author, created_at) · CHUNK(hash PK, size, refcount) · CHANGE_LOG(namespace_id, seq, file_id, version)

5. The design, in three versions

Version 1: Whole files on one server

Clients upload whole files to an app server that writes them to its disk.

File Sync Service (Dropbox / Google Drive): Version 1: Whole files on one server Version 1 of 3

The picture follows one request through the parts of this version, in order. Under it, switch a part off to see what the request does without it.

One request, step by step

Each numbered arrow is one step. Press "Simulate Request Flow" to follow them one at a time.

Your deviceSync serviceLocal disk123
  • The order of the steps
  • A request or its reply

The parts: switch one off

1. Clients

Your devicesplits a file into chunks

2. Services

Sync servicefile names, chunks, versions

3. Data, outside

Local diskwhole files on one server

The steps in words0 of 3 steps shown

  1. Your device to Sync serviceHTTPS · 3 ms

    The device uploads the whole file.

  2. Sync service to Local diskquery · 8 ms

    The server saves it on its own disk.

  3. Sync service to Your devicereply · 20 ms

    The device gets "saved".

Why this version
Quick to build.
Next bottleneck
A failed large upload restarts from zero, every edit re-uploads the whole file, and one disk holds everything.

Write path, read path and failures

Each path follows one request through the final design (version 3), one hop at a time.

Write pathSave a changed file

  1. Desktop app
  2. Metadata API
  3. Object storage
  4. Change log
  5. Notification service
  1. Desktop app to Metadata API

    The app cuts the file into chunks, for example 4 MB each, and hashes each one. It asks which hashes the server does not have yet.

  2. Desktop app to Object storage

    It uploads only the missing chunks. If the connection drops, it carries on from the next chunk.

  3. Desktop app to Metadata API

    It commits the new version: the list of chunks and the version it was edited from.

  4. Metadata API to Change log

    If that version is still the latest, the commit is added to the change log with the next number. If not, the server keeps both and saves a conflicted copy.

  5. Change log to Notification service

    The notification service tells the user's other devices that something changed.

Read pathAnother device catches up

  1. Notification service
  2. Laptop app
  3. Metadata API
  4. CDN
  1. Notification service to Laptop app

    The laptop keeps a connection open and hears that its place in the change log is out of date.

  2. Laptop app to Metadata API

    It asks for every change after its place, and gets each new version with its list of chunks.

  3. Laptop app to CDN

    It downloads only the chunks it does not have yet.

  4. CDN to Laptop app

    The app rebuilds the file from its chunks and moves its place forward.

What breaks, and what happens then

  • An upload drops at 90%

    What users see
    The chunks already sent are safe.
    What the design does
    The app sends only the missing chunks, then commits.
  • Two devices edit the same file while offline

    What users see
    Both commits name the same earlier version.
    What the design does
    The first commit wins. The second becomes a conflicted copy, so neither edit is lost.
  • The notification service is down

    What users see
    Other devices learn about changes late.
    What the design does
    Devices also ask on a timer. Each one reads the change log from its own place, so a change is late but not missed.
  • A metadata database shard fails

    What users see
    Users on that shard cannot commit for a short time.
    What the design does
    A replica of the shard is promoted. Chunks keep uploading, and the commit is retried.

6. Deep dives

Content-defined chunking and deduplication
With fixed-size chunks, inserting a few bytes near the start shifts every later chunk. Content-defined chunking picks boundaries with a rolling hash, so a small edit changes only one or two chunks. Chunks are stored once by hash and reference-counted.
Conflicts
Two offline devices edit the same file. The first commit wins; the second arrives with an old base version and is saved as a conflicted copy for the user to resolve. Real-time co-editing, as in Google Docs, is a different problem that needs OT or CRDTs.

7. Follow-up questions

  • How do you sync a folder shared by 10,000 people? (A change log per shared namespace, fan-out of notifications, and rate limits per folder.)
  • How do you delete a user's data for good when chunks are shared? (Reference counts, deleting a chunk when its count reaches zero, or per-user encryption keys that can be destroyed.)

What it costs

Stored bytes are almost the whole bill: 500 PB before duplicate blocks are removed. Storing each block once, and compressing it, saves the most. Download traffic is the second cost.

Another way to design it

You can sync whole files and skip the split into blocks. The client and the server become much simpler. A small change to a large file then uploads the whole file again.

8. How answers are judged

A passing answer at Mid level. A complete design with numbers: about 2,300 file changes a second on average. It splits files into chunks named by content hash, sends only changed chunks, and goes deep on one part, such as chunking or conflicts.

How each level is judged
What is judgedJuniorMidSeniorStaff
BreadthHow much of the system does the answer cover?Names the core parts: clients, servers, a database and a cache.Covers the whole main flow, from the request to the stored data and back.Builds a complete design without being led through it.Covers the system, the systems around it and who owns each part.
DepthHow far does it go into the hard parts?Explains what each part does and why it is there.Goes deep on one part, such as the database or the cache.Goes deep on the two or three riskiest parts.Goes deepest where the risk is largest, and explains why the risk is there.
DrivingWho leads the conversation?Follows the interviewer, step by step.Moves forward alone, with an occasional nudge.Leads the conversation from start to finish.Changes the problem when the question asked is not the right one.
Trade-offsAre choices compared and justified?Names more than one option.Says why one option was picked over another.Compares options in detail, with what each one costs.Ties each choice to cost, speed and risk for the business.
Unclear questionsWhat happens when the question is vague?Answers the questions that are asked.Asks questions to make the problem clear.Sets the scope and says what is left out.Questions the assumptions behind the problem itself.
ScopeWhat does it consider beyond the normal path?Covers the normal path, when everything works.Adds what happens when a part fails.Adds growth: what breaks at ten times the load, and the fix.Adds abuse, cost and the daily work of running the system.

Requirements and scope

Strong answer
Before I design, I want to check the scope. Files sync across a user's devices and can be shared with others. Real-time co-editing, like Google Docs, is a different problem. I will assume it is out of scope, and that a later edit to the same file creates a conflicted copy.
Weak answer
Users edit files on one device and expect every other device to show the same content right away. So I will design live, character-by-character merging, the same way a collaborative editor does.

Shows: Unclear questionsThe difference: The weak answer assumes live co-editing is needed without asking, which is a much harder problem than syncing whole-file versions between devices.

Estimates

Strong answer
10 million daily active users changing about 20 files a day is about 2,300 file changes a second. Total files come to about 500 petabytes before dedup. The metadata a database must index, such as file names and chunk lists, is only about 50 terabytes.
Weak answer
50 million users storing 10 GB each is 500 petabytes, so the database needs to hold about 500 petabytes of rows.

Shows: DepthThe difference: 500 petabytes is the raw file content, which belongs in object storage. The database only holds about 50 TB of metadata, not the files themselves.

Core design

Strong answer
Each file is split into chunks named by a hash of their content, and only chunks the server does not already have are uploaded. A commit lists the chunk hashes for a new version. An edit that changes one paragraph sends only the changed chunks, not the whole file.
Weak answer
When a file changes, the client uploads the whole file again and the server saves it as a new version, alongside the old ones.

Shows: DepthThe difference: Uploading the whole file on every small edit ignores that only a few chunks actually changed. Sending only the changed chunks saves bandwidth and time.

Deep dive

Strong answer
The hard part is two offline devices editing the same file. Each commit carries the version it was edited from. If the file has since moved on, I keep the incoming edit as a conflicted copy instead of overwriting. The user resolves it, and nothing is silently lost.
Weak answer
If two devices both change the same file while offline, I would keep whichever change reaches the server last.

Shows: Trade-offsThe difference: Keeping only the last write silently discards the other device's real edit. Saving a conflicted copy keeps both instead of losing one.

Failures and trade-offs

Strong answer
If a large upload drops partway through a flaky connection, the client does not restart from zero. It asks which chunks the server still needs, by their hashes, and resumes with only those. The hashes already show what has and has not arrived.
Weak answer
If an upload drops partway through, I would have the client start the upload over from the beginning once the connection comes back.

Shows: ScopeThe difference: Restarting a large upload from zero after every drop wastes time and bandwidth on a flaky connection. Resuming from the missing chunks avoids that.

We wrote this guide in our own words, informed by public interview guides such as AlgoMaster and Hello Interview. We are not connected to either site. Interviewers differ. The guide and the example answers show the direction each level takes, not a checklist.

10. Check your design with your own AI

Write your design first. Then copy this prompt into the AI chat you already use, and add your design at the end. It asks for a score in each area, one fix for each, and two follow-up questions.

The site sends nothing anywhere. An AI review can be wrong, so check what it says against sections 8 and 9.

See the prompt
You are a system design interviewer. Review my design for the interview problem below.

Problem: Design a File Sync Service (Dropbox / Google Drive)
Keep a user's files in sync across laptops and phones, with efficient uploads and a clear rule for conflicting edits.

What users must be able to do:
- Upload, download and delete files and folders.
- Sync changes to all of a user's devices, including after being offline.
- Share files and folders with other users.
- Keep version history.

How well it must work:
- Durability: never lose a committed file.
- Large uploads survive flaky connections (resumable).
- Small changes reach other devices within seconds.
- Send only what changed.

Numbers to assume:
- 50 million users, 10 million daily active; an average user stores 10 GB.
- Each active user changes about 20 files a day.

Judge my design at the Mid level.
A passing answer at this level: A complete design with numbers: about 2,300 file changes a second on average. It splits files into chunks named by content hash, sends only changed chunks, and goes deep on one part, such as chunking or conflicts.

For each area below, say whether my design is strong, fine or weak. Give one reason and one fix for each:
1. Requirements and scope
2. Estimates
3. Core design
4. Deep dive
5. Failures and trade-offs

Then ask me the two follow-up questions an interviewer would ask next.
Do not write a full model answer for me.

My design:
[Describe your parts, how one request moves through them, and why you chose each one.]