System requirements
Functional:
- User should be able to upload file
- User should be allowed to edit file and upload new version
- User should be able to download
- User should be able to share the file
- User should be able to drop multiple files together.
Non-Functional:
- Data should be available
- Storage isn required as its basically a storage of data
- Scalable
- Consistent
- Fault tolerance
- Security not everyone should be able to access data
- Faster access
- Replicated across devices
Capacity estimation
Estimate the scale of the system you are going to design...
API design
- upload api POST /dropbox/upload body multipart file
user uploading will be by default added as admin for the file
- Download GET /dropbox/upload Response - file downloade
- Edit PUT /dropbox/upload body multipart file
- Share PUT /dropbox/share/user email along with file details to be shared
- delete delete /dropbox/delete file selected only user who has admin access can delete
- Create Folder POST /dropbox/create-folder
6. deleteFolder POST /dropbox/create-folder
Database design
NO SQL database is the right choice as we are dealing unstructured data but for access control we need structured datas which can work for the worlds
User details
Metadata of file
File details related to s3 where it is uploaded
access control of the file it checks here if any other user then admin has access to read/ write etc.
High-level design
Postgres is the right choice or mongo
AWS S3 for storage
caching the metadata
fecthing presigned url from s3 and storing in file details
ACID to be taken care it should not happen user added access to some other use but some other user removed it
caching eventual will also work but saga pattern to be implemented it should be delete from s3 + clear all metadata from tables
we can use multiple service one for metadata other for files data so that meta service is reusable
Request flows
Explain how the request flows from end to end in your high level design. Also you could draw a sequence diagram using the diagramming tool to enhance your explanation...
Detailed component design
Dig deeper into 2-3 components and explain in detail how they work. For example, how well does each component scale? Any relevant algorithm or data structure you like to use for a component? Also you could draw a diagram using the diagramming tool to enhance your design...
Trade offs/Tech choices
Explain any trade offs you have made and why you made certain tech choices...
Failure scenarios/bottlenecks
Try to discuss as many failure scenarios/bottlenecks as possible.
Future improvements
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?