TypeScript · 2023
Pastebin R2
A pastebin on Cloudflare Workers backed by R2 object storage: Hono routes the API and web UI, pastes render with syntax highlighting and expire on their own after 48 hours.
The problem
Provide a small paste service whose objects expire predictably, without introducing a separate application server or database for the paste bodies.
Architecture
- Hono routes the API and browser interface in a Cloudflare Worker.
- R2 stores paste bodies and expiry metadata.
- Reads enforce expiry immediately while an hourly cron removes expired objects.
Highlights
- Syntax-highlighted and plain-text views
- Configurable lifetimes capped at 48 hours
- Create, update, delete, list and metadata endpoints
Technology
TypeScript · cloudflare · r2 · hono