Design a file storage and sync service (like Dropbox).
Answer
- Split files into chunks (e.g. 4 MB) and hash each chunk; upload only changed chunks (deduplication, resumable uploads).
- Chunks in object storage (S3); a metadata database stores files, versions, chunk lists and permissions.
- Upload directly to storage with pre-signed URLs.
- Sync: clients keep a cursor; a notification service (long polling / WebSocket) announces changes; clients pull new metadata.
- Conflicts: keep both copies, or version history.
- Sharing with ACLs and links; CDN for downloads; encryption at rest.
Practice this question in Repaso