Skip to content

Pastebin — Notes#

Functional#

  • Anonymous or authenticated paste creation.
  • Short URL → text body retrieval.
  • Optional: expiry, password, language tag, view counter.
  • Edit / delete by owner.

Non-functional#

  • Read-heavy (10:1).
  • p99 read < 200 ms.
  • Durable: never lose body once written.

Capacity#

  • 1M new pastes/day → 12/s avg.
  • 10M reads/day → 120/s avg.
  • Avg paste 10 KB → 10 GB/day → ~3.6 TB/year.
  • Hot working set 1 day: ~10 GB cache.

API#

POST /v1/paste {text, lang, expiry, password?} -> {id, url}
GET  /v1/paste/{id}                            -> {text, lang, ...}
DELETE /v1/paste/{id}                          (owner / token)

Schema#

pastes(id PK, owner_id, lang, expires_at, created_at, size, sha256, abuse_flag)
Body lives in S3 at s3://bucket/p/<id>.

Trade-offs#

  • Store body in DB (simple) vs S3 (cheap at scale). S3 wins beyond a few GB.
  • Single-region simple; multi-region needs S3 replication + DB replication.
  • Strong vs eventual read after write: read-after-write critical for newly created pastes — pin first read to same DC.
  • Encryption client-side prevents server abuse but no server-side search.

Refs#

  • pastebin.com architecture posts, GitHub Gist design, ByteByteGo "Design Pastebin" video, Alex Xu Vol 1.