KatInterview

Design a Distributed File Sync and Sharing Platform

System DesignModel answer
MediumModel answerSystem Designdistributed-systemsstorageapi-design

Last updated

Build the architecture for a multi-client file storage system with hierarchical organization, collaborative sharing, chunked uploads, and cross-device synchronization.

Design the backend architecture for a file storage platform that supports multiple concurrent clients and collaborative workflows.

Your system should enable users to organize files in nested directories, grant access to collaborators with different permission levels, and maintain consistency across web browsers, desktop applications, and mobile devices. The platform needs to handle connection interruptions gracefully and preserve a history of changes.

Core Requirements

Your design must address:

  • File operations: creating, retrieving, removing, relocating, and renaming both files and directories
  • Hierarchical organization: nested directory structures owned by individuals or teams
  • Collaborative access: granting permissions (owner, editor, commenter, viewer) that cascade through subdirectories
  • Resilient uploads: breaking large files into segments that can resume after network failures
  • Historical tracking: maintaining previous file states with restoration capability
  • Multi-device consistency: propagating changes to all connected clients, including handling modifications made while offline
  • Discovery: finding files by name, owner, type, and modification timestamp
  • Reliability: ensuring high uptime, data durability, and protection against unauthorized access

Describe your end-to-end architecture including: component organization, API contracts, storage layer design, data schema, upload/download flows, client synchronization mechanism, consistency guarantees, horizontal scaling strategy, failure recovery, and key engineering trade-offs.

Scale & Performance Expectations

  • User base: expect 10M+ registered accounts with several million actively syncing clients maintaining persistent connections
  • Storage volume: petabyte-scale corpus with individual files ranging from kilobytes to multiple gigabytes
  • Request patterns: predominantly read-oriented (downloads, listings, sync checks) outpacing writes roughly 10:1, though write volume remains substantial
  • Durability goal: match industry-standard object storage (approximately 99.999999999% annual durability through geographic replication)
  • Availability goal: keep core metadata and download operations available; search and thumbnail generation can tolerate brief degradation
  • Security requirements: encrypted transport and storage, time-limited signed access tokens, audit logging for access and sharing events
  • Out of scope: concurrent multi-user document editing with conflict-free merge (treat as separate real-time collaboration layer); simple last-write-wins or conflict-copy approach suffices

Recommended Clarifications

Consider asking:

  • Does isolation occur at the individual user level, or do shared team/organization workspaces exist with independent permission trees?
  • What file size distribution should we optimize for, and what's the maximum supported file size?
  • Should we implement block-level differential sync (re-uploading only modified chunks), or is full-file replacement acceptable initially?
  • How sophisticated are permission requirements—simple access lists, or nested groups, public links with expiration and passwords?
  • Does search need to index file contents, or only metadata attributes?
  • What retention policies apply to deleted items and version history (trash retention period, version count limits)?
  • Do we need active-active multi-region writes for global low latency, or is single-write-region with read replicas sufficient?

Hints

Hint 1

Separate concerns: metadata operations (permissions, directory structure) have different consistency needs than blob storage (immutable file contents).

Hint 2

For resumable uploads, consider how clients can upload chunks independently before atomically committing the complete file manifest.

Hint 3

Synchronization requires tracking a sequence of changes—think about how clients efficiently discover what's new since their last sync without scanning the entire tree.