System will provide 2 APIs. One endpoint to receive the text to be stored, and a second endpoint to receive a code and return the text.
Backend is decoupled from front-end developed as RESTful API.
# Save text endpoint
POST /text {text: "my-text"}
Response:
HTTP Status Code: 201
Payload: {url: "https://my-pastebin.com/:unique-code", expires_at: "timestamp"}
# Get text endpoint
GET /text/:code
Response:
HTTP Status Code: 200
Payload: {text: "my-text"}
Store data on postgres with replicaset. Setup connection pool on app connections.
texts table:
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...
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...
Explain any trade offs you have made and why you made certain tech choices...
Try to discuss as many failure scenarios/bottlenecks as possible.