Paste-sharing service inspired by Pastebin and GitHub Gist: unguessable keys from a key generation service, text in object storage with key-value metadata, a read cache, a CDN for viral pastes, write limits and expiry cleanup. A teaching design.
See the problems with sequential ids, text in database rows, and no cleanup.
What was missing: Nothing yet.
Why that's risky: Sequential ids let anyone enumerate every paste, multi-megabyte text bloats the database, every read hits it, and expired pastes pile up forever.
What gets added: One server that stores paste text in a database row under an auto-increment id and reads it back.
Trade-offs: Simple, but neither private nor scalable.
Give each paste an unguessable key and keep large text out of the database.
What was missing: Sequential ids and paste text inside database rows.
Why that's risky: Every read still fetches metadata and text from storage, though reads outnumber writes 100 to 1.
What gets added: A key generation service handing out random 8-character base62 identifiers from a pre-generated pool, a write service that uploads text to object storage and records a small key-value metadata row, and a read service.
Trade-offs: Pre-generating keys means a server that crashes loses its unused batch, which is harmless with 62⁸ possible keys.
Serve the read-heavy traffic from memory.
What was missing: Every read went to storage.
Why that's risky: A viral paste still sends every view to our servers, and spammers can create pastes as fast as they like.
What gets added: A paste cache holding hot text and metadata by key in front of the metadata DB and object storage.
Trade-offs: Cached pastes can't be edited, which suits pastes: they are immutable once created.
Absorb viral links at the edge and stop spam at the door.
What was missing: Viral pastes reached our servers, and paste creation was unlimited.
Why that's risky: Expired pastes are hidden but never deleted, so storage grows forever.
What gets added: A CDN serving the raw text of public pastes, and a write limiter per IP and account.
Trade-offs: Private pastes bypass the CDN, since they must not be cached at the edge.
Actually delete expired pastes and watch the service.
What was missing: Expired pastes stayed in storage forever.
Why that's risky: Remaining risk is abuse content, which needs reporting and takedown tools.
What gets added: A delayed job per paste with an expiry and a cleaner that deletes its text and metadata when the TTL passes, plus monitoring of hit rate, read latency, pool size and spam.
Trade-offs: Cleanup may run a little after expiry; reads already return 404 at the expiry time.
You're in the middle of an interview session. Leaving now will end your current attempt.
Explore concept overviews, real-system examples, key tradeoffs, and interview talking points for each roadmap section.
You've conquered this phase. These are the skills you now own: