System requirements


Functional:

  1. User should be able to upload file
  2. User should be allowed to edit file and upload new version
  3. User should be able to download
  4. User should be able to share the file
  5. User should be able to drop multiple files together.



Non-Functional:

  1. Data should be available
  2. Storage isn required as its basically a storage of data
  3. Scalable
  4. Consistent
  5. Fault tolerance
  6. Security not everyone should be able to access data
  7. Faster access
  8. Replicated across devices




Capacity estimation

Estimate the scale of the system you are going to design...






API design

  1. upload api POST /dropbox/upload body multipart file

user uploading will be by default added as admin for the file

  1. Download GET /dropbox/upload Response - file downloade
  2. Edit PUT /dropbox/upload body multipart file
  3. Share PUT /dropbox/share/user email along with file details to be shared
  4. delete delete /dropbox/delete file selected only user who has admin access can delete
  5. 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?