Implement File Sharing App
Difficulty: MEDIUMCategory: HLDFrequency: 1Asked On 2024-04-22
Problem Statement
Designing a scalable, fault-tolerant, and secure File Sharing System that allows users to upload, store, share, and collaborate on files across devices. The system should support large file sizes, access control, and real-time collaboration features while ensuring performance, durability, and availability.
🔶 Functional Requirements
1.User & File Management
•User authentication & profiles.
•Upload, download, delete, and update files.
•Organize files into folders/directories.
•Support version history (rollback to previous versions).
2.File Sharing & Collaboration
•Share files/folders via link or direct user access.
•Permissions: view, comment, edit, owner.
•Collaborative editing support (optional, like Google Docs).
3.Search & Metadata
•Full-text search on filenames, metadata, and file content.
•Tagging & filtering.
4.Access & Sync
•Sync across multiple devices (desktop, mobile, web).
•Offline file support with auto-sync when online.
•Partial downloads (resume from breakpoint).
5.Observability
•Activity log: uploads, edits, shares, deletes.
•Notifications on updates/shares.
🔶 Non-Functional Requirements
•Scalability: Handle billions of files across millions of users.
•Durability: Files must not be lost (multi-replication or erasure coding).
•Availability: High uptime, survive node/datacenter failures.
•Performance: Upload/download latency should be minimized (use CDN/edge).
•Security: Data encryption at rest and in transit, role-based access control, auditing.
•Cost-efficiency: Optimize storage with deduplication and compression.
🔶 Constraints
•Files can be very large (up to multiple GBs).
•Must support concurrent access from multiple users.
•Must allow resumable uploads/downloads (chunking).
•Storage should be distributed object storage (like S3, HDFS, or custom DFS).
•Metadata and access control must be consistent across replicas.
🔶 Example Use Cases
1.A user uploads a 2 GB video file → system chunks, stores across distributed storage, and allows resuming if interrupted.
2.A file is shared with “view only” permissions → shared user can view but not edit/download.
3.A team collaboratively edits a shared document → changes are synced in near real-time.
4.User searches for “project_report_2023” → system retrieves using metadata + full-text search.
5.A deleted file → stays in trash for 30 days before permanent deletion.
👉 Summary:
"Design a distributed, secure, and scalable File Sharing Application that supports file upload/download, sharing with fine-grained permissions, real-time collaboration, and ensures durability, availability, and efficient search."