Pastebin Service diagram template

Store and share text snippets with object storage for content and a database for metadata.

Pastebin Service architecture diagramOpen in ArchBoard

Builds a new scene in your browser. Your existing scenes are not touched.

About this design

Pastebin is a lesson in separating what changes from what does not. The text of a paste is immutable once written, so it belongs in object storage where it is cheap, durable and cacheable at the edge. The things that do change, such as expiry time, visibility and view counts, live in a small relational table keyed by paste id. A write returns a short identifier produced by a key service, then the content lands in a bucket under that key. Reads check the cache, fall back to the metadata row to confirm the paste has not expired, and stream the body from storage. A scheduled cleanup job deletes expired rows and objects together, which is the part candidates forget. Discuss size limits, syntax highlighting done on the client, and what happens when one paste goes viral and a single object key becomes hot.

Diagram as text

This is the source of the diagram, in the ArchBoard diagram DSL. Paste it into Tools, Diagram from text to rebuild or change it.

title "Pastebin"
direction LR
client "Browser" -> cdn "CDN" -> service api "Paste API"
[api x2]
api -> cache redis "Paste cache"
api -> db postgres "Paste metadata"
api -> storage s3 "Paste content"
cron expiry "Expiry job" -> paste-metadata
expiry -> paste-content

More interview classics templates