System Design
Pastebin
Design a Pastebin-style text snippet sharing service.
Functional requirements
- Users (anonymous or registered) can create a paste of plain text and receive a short, unique URL for it.
- Anyone with the URL can read a paste, subject to its visibility setting: public, unlisted, or private (accessible only to the owner or an explicit allow-list).
- Paste creators can set an expiration: a TTL (e.g., 10 minutes, 1 day, 1 month), 'never', or 'burn after read' (paste becomes unavailable after the first successful view).
- Registered users can list, edit metadata of (e.g., change expiry/visibility), and delete their own pastes.
- Expired or deleted pastes must return a clear 'gone' response, not stale content.
Non-functional requirements
- Highly available for reads; a paste that was just created must be readable via its URL within ~1 second (read-your-writes for the creator; brief staleness for other readers is acceptable).
- Read latency: p99 under 200 ms for pastes up to 1 MB; write (create) latency p99 under 500 ms.
- Durability: once a create is acknowledged, the paste must not be lost before its expiry (11 nines-style durability expectation for the content).
- Security: private pastes must never be readable by unauthorized parties, and paste URLs for unlisted pastes must not be practically guessable/enumerable.
- Expiry must be enforced correctly: an expired or burn-after-read paste must never be served after its deadline or first read.
Scaling & constraints
- 50 million monthly active readers; 5 million pastes created per day.
- Read:write ratio of roughly 100:1, with heavy skew: a small fraction of pastes (viral code dumps, config shares) receive the majority of reads.
- Paste size: median ~10 KB, p99 ~500 KB, hard cap 10 MB.
- Retention mix: ~60% of pastes have a TTL of 1 day or less, ~30% between 1 day and 1 month, ~10% 'never expire'.
- Traffic and paste volume growing ~30% year over year; plan for 5 years.
- Global user base; a single home region is acceptable but reads come from everywhere.
Out of scope
- Syntax highlighting, rendering, diffing, or any client-side presentation features.
- Full-text search over paste content.
- Abuse/malware/spam detection and content moderation pipelines.
- Billing, quotas, or paid tiers.
Sign in to save your progress
AI design evaluation
Get a grounded score, what your design does well, its gaps, and what to study next.
Sign in to get AI feedback on your design.