systemDesignInterview

My question

  1. Design Pastebin, a website where you can store and share text online for a set period of time.

Note: Bit.ly is a similar service, with the distinction that Pastebin requires storing the paste contents instead of the original unshortened URL.

  • note: Use it to share thoughts and resources, such as:
  • Features scope
  • API design
  • Pseudo code for specific components
  • Data model/schema
  • Back-of-the-envelope calculations
  • Reference links
  • Link to whiteboard or diagram such as https://sketchboard.me/new
  • hints: interview structure
  • Establish the feature scope and constraints
  • Describe high-level architecture
  • Drill Down: design and scale core components
  • Scaling the design
  • Tradeoffs and future improvements

Note and Solution

text -> pastebin no expire time

build a restful api with post method store text in the dabase

api and then when hit api return text in brower.

txt file, service parse the text file, get string, and store in the backend.

txt -> api -> user want the text, url get list of text or one recent text

front end -> save txt file -> backend -> id-> bit.ly service -> url for text

  1. user table
    user id

2 text table
text id
text content
date

solution1: url for txt -> backend -> response with txt file

  • solution2: optimized high level design
    1
    2
    3
    4
    5
    6
    7
    client ->(LB) server -> readApi-> cache  duplicate
    server readApi DB
    DB
    ...
    ...
    server -> writeApi-> (master and slave DB)
    nosql

Pasterbin use case
Review this article to learn about the use cases, high level design, core components and scale of a system like Pastebin.