It was asked to me in Amazon interview for SDE-2 position.
What is Pastebin?
Pastebin web service enable users to store plain text over the network and generate unique URLs to access the uploaded data. It is also used to share data over the network quickly, as users would just need to pass the URL to let other users see it.
Functional Requirements:
Non-Functional Requirements:
Database Design:
User table
a. name
b. email
c. created_date
d. last_login
e. userId - PK
Paste
a. paste_name
b. url
c. content
d. expiration_time
e. created_date
f. userId - FK
g. pasteId - PK
System APIs
Can be implemented as Restful Webservices as -
High Level Design
At a high level, the system needs an application server that can serve read and write request. Application server will store paste data on block storage. All the metadata related to paste and user will be stored into a database. At a high level, various cache servers and load balancer can be configured to improve performance and scalabilty of the system.
