System Design Playbook
03 · System designs100 users → 100M+ users13 min read

Design Google Drive / Dropbox (file storage and sync)

Store files of any size, keep them in sync across every device, share them with fine-grained permissions and never lose a byte. The key ideas: separate metadata from content, split files into hashed blocks, and notify devices of changes instead of having them scan.

In one sentence

Split files into content-addressed blocks in object storage, keep the folder tree, versions and permissions in a strongly consistent metadata store, and notify devices so they fetch only what changed.

A reference design: it covers what an app like this needs and follows how these companies have described their systems publicly, simplified to be learnable.

Requirements

Functional

  • Upload and download files of any size
  • Folders, rename, move, delete, versions
  • Sync across desktop, web and mobile
  • Share with view/edit permissions

Non-functional

  • Durability: never lose a file (11 nines in object storage)
  • Metadata strongly consistent
  • Large uploads resumable on bad networks
  • Efficient sync: don't re-upload unchanged data

Back-of-the-envelope estimates

MetricEstimate
Users1B with ~15 GB each on average used → ~15 EB (before dedup and compression)
Files~1,000 per user → 1 trillion metadata rows
Uploads~2 files per user per day → ~25K file commits/s
Sync checksHundreds of millions of connected devices waiting for changes

API and data model

POST /blocks/check   { hashes[] }            → missing[]
PUT  /blocks/:hash   (4 MB, resumable)
POST /files/commit   { path, blockHashes[], baseVersion } → { version } | conflict
GET  /changes?cursor=…                       → [ change ], newCursor
POST /files/:id/permissions { user, role }

files(id, namespace_id, parent_id, name, version, block_hashes[], deleted)
blocks(hash PK, size, location)   permissions(file_id, user_id, role)

Architecture

Architecture
Scale
Follow a request
◱Desktop syncwatches a folder◱Web / mobile⇄API gateway⚙Block service~4 MB chunks⚙Metadata servicetree + versions⚙Syncnotificationslong polling / WS↻Previewsthumbnails, OCR⚙Sharing & ACL▣Object storagefiles / blocks⛁PostgreSQLfiles, folders, ACLsϟRedislistings, ACLs

Step by step · Upload a 1 GB file

  1. 01New file: split into 250 blocks of 4 MB, each hashed
  2. 02Upload request
  3. 03Only blocks it doesn't have yet are uploaded (resumable)
  4. 04Blocks stored by hash
  5. 05Commit: file = [hash1, hash2, …] version 1
  6. 06Metadata row saved
  7. 07Other devices told to fetch changes
  8. 08File appears everywhere

At this scale · 1M users

Blocks, metadata and sync as separate services

  • ▸Files split into ~4 MB blocks identified by their hash: resumable and deduplicated
  • ▸A file version is just a list of block hashes
  • ▸Sync service tells devices what changed (long polling / WebSocket)

Tap any box to see what it does.

Deep dive: blocks and deduplication

  • Resumable: a dropped connection only re-sends the block in progress.
  • Delta sync: editing a 1 GB file uploads only the changed blocks.
  • Deduplication: blocks are named by their hash (SHA-256). If a thousand users upload the same PDF, it's stored once.
  • Immutable content, mutable metadata: blocks never change, so they cache and replicate trivially; all the hard consistency lives in the metadata store.

Sync works with a change log per namespace: each device remembers a cursor, and the notification service tells it when there's something newer, so it never has to scan the whole tree.

How it changes with scale

Architecture
Scale
Follow a request
◱Desktop syncwatches a folder◱Web / mobile⚙App serverfiles + folders▣Object storagefiles / blocks⛁PostgreSQLfiles, folders, ACLs

Step by step · Edit and sync

  1. 01Edits a slide: 2 of 250 blocks change
  2. 02Whole file uploaded again
  3. 03New blocks stored
  4. 04Polls and downloads the new file

At this scale · 100 users

Files in a bucket, folders in SQL

  • ▸Whole files uploaded to object storage
  • ▸Folders, files and permissions in PostgreSQL
  • ▸Clients poll every minute to see what changed

Tap any box to see what it does.

UsersWhat you runWhy it changes
100App + PostgreSQL + S3, whole-file upload, pollingSimple and correct
10KSigned URLs + CDN, preview workers, RedisTraffic must bypass the app; previews are slow
1MBlock, metadata, sync and sharing services; delta syncBandwidth and sync latency
100M+Metadata sharded by namespace, multi-region blocks, tiered storage, searchExabytes and trillions of rows

Key takeaways

  • 01Separate metadata (small, consistent) from content (huge, immutable).
  • 02Hashed blocks give resumable uploads, delta sync and deduplication.
  • 03Devices follow a per-namespace change log and get notified instead of polling.
  • 04Shard metadata by user or namespace so moves stay single-shard transactions.

Check your understanding

1 of 3

In a file storage service like Google Drive or Dropbox, why separate metadata from file content?

Security PlaybookNow attack it: threat-model this designFind the STRIDE threats in this architecture and pick the mitigations.↗