Command Palette

Search for a command to run...

PHASE 12Advanced ~7 min· topic 5 of 39Level 1

System 12.5 — Pastebin

In one line

URL shortener + file storage hybrid: text blobs with read-once/expiry semantics.

0/39 · 0%

Think of it like this

A text version of a URL shortener — you paste some text, get a short link back, and anyone with that link can read the text, sometimes only once before it self-destructs.

Key ideas

  1. 01

    Write path: POST text → store blob (DB/object store) → return short id; reads GET /{id} → render.

  2. 02

    Unlike shortener: content is large and VALUES-ranked not just read — cache and DB lightly.

  3. 03

    Unlisted vs secret: secret pastes use unguessable random ids (not counters) — read-once/expiry via TTL rows.

  4. 04

    Scale: 10k/day writes, reads 10:1; blob sizes 1KB–10MB → object store + metadata row.

  5. 05

    Syntax highlighting: client-side render; server only stores raw text.

  6. 06

    Consistency: none beyond read-your-writes; TTL sweeper deletes expired blobs + rows.

  7. 07

    Interview lesson: it's 90% shortener + 10% blob — say that and go fast.

Code & diagrams

PastebinFlowdiagram

90% shortener, 10% blob — the diagram is almost identical to url-shortener with a bigger payload.

Rendering diagram…

Explain without notes

01

Why do secret pastes need random ids while public shortlinks can use counters?

Practice

01

Migrate-paste into the shortener design: what changes in storage and TTL sweeper?

Trade-offs

  • ↔

    DB storage simple vs object-store cheaper per GB — pick by paste size histogram.

Completion checklist

  • I can produce pastebin as 'shortener + blob + TTL' in one breath.

Back to phase