Dev Skills

Design file sync like Dropbox

Design a file sync service. A folder on several devices stays in step, edits made offline sync when the device reconnects, and history is recoverable. Files range from a few kilobytes to several gigabytes.

About this problem

“Design file sync like Dropbox” is a hard-level problem in the sync and offline family. The same data lives on several devices, all of which can be edited while disconnected.

The key challenge: The local device must feel instant even with no network at all. Everything else (reaching other devices, agreeing with the server, resolving conflicts) has real slack. The design is built on that asymmetry.

Time budgets: Local edits: zero. Propagation: seconds. Full sync of a new device: hours.

The worked solution for File sync goes through why those budgets shape the design, stage by stage.

Before you start

You will work this in five timed stages. Here is what each one asks you to think about. None of it is the answer; the answers unlock in the workspace below once you have written your own.

  1. Stage 1 · Requirements · 5 min
    • Is this one user with many devices, or many users sharing a folder? Very different systems.
    • What happens when two people edit the same file offline? Is that a merge or a conflict?
    • How much history do you keep?
  2. Stage 2 · Actors and lifecycle · 6 min
    • Each device is a separate actor with its own view of the truth.
    • What does the system decide about a change nobody told it about?
    • What happens when a device has been offline for a month?
  3. Stage 3 · Numbers · 6 min
    • What does chunking actually save when someone edits a large file?
    • How much metadata is there per file, and does it fit in a database?
    • How many notifications per second, once you do the sum?
  4. Stage 4 · High-level design · 12 min
    • What does the client store locally, and why does it need its own database?
    • How does a device know what it is missing?
    • How do chunks get uploaded without passing through your servers?
  5. Stage 5 · Deep dive and tradeoffs · 14 min
    • Two devices edited the same file offline. Walk through what each one sees.
    • A user drops in 50,000 files at once. What happens?
    • What deletes a chunk, and how do you know it is safe?
Prefer to read first? The worked solution, end to end →

Work it through

Five stages, gated. You write your answer for each stage before its model answer unlocks. That is the core of the method.

Loading your progress…

Done all five? The diagrams, numbers, trade-offs and follow-ups for this problem are on the worked solution page, to check your own design against.

Before you leave
Try this problem again in a week without reading anything. Comparing what you write then with what you wrote today shows you what stuck.
Stuck, or new to this?Read the full worked solutionAll five stages end to end, with the diagrams and the costs, written out the way you would say it. Best read after you have had a go.Read it →

How it is really built

Write your own answer first. Then read how teams who run this at scale describe it. Their constraints were real, and the write-ups often say what their choices cost.