Skip to main content

Pastebin

Let's design a Pastebin like web service, where users can store plain text. Users of the service will enter a piece of text and get a randomly generated URL to access it.

Requirements

Functional

  • Creation: Upload or paste data and get a unique URL.
  • Read: users can get the data by the URL.
  • Data and links have expire data, users can specify the expire time.
  • Users can pick up custom alias

Non-Functional

  • Reliable data, should not be lost.
  • Real-time access with minimum latency
  • The link should not guessable.

Extended requirements

  • Analytics. How many times a paste was accessed?
  • REST API
  • Size limit 10 MB
  • Custom URL limit.

Capacity Estimation and Constraints

  • Traffic

  • Storage

  • Bandwidth

  • Memory

System API

addPaste(api_dev_key, paste_date, custom_url=None, user_name=None, past_name=None, expire_date=None)

getPaste(api_dev_key, api_paste_key)

deletePaste(api_dev_key, api_paste_key)

Database Design

Schema

Paste: URLHash, ContentKey: char[], expiredate: datetime, userID: int

User: Name : string, email: string, creation_data: datatime, lastLogin: datetime.

High Level Design