A simple, secure, and blazing fast Pastebin built with Cloudflare Workers, D1 Database, and Hono.
- Blazing Fast: Runs on Cloudflare's edge network.
- Dynamic ID: Automatically scales ID length from 2 to 10 characters based on collision.
- Secure:
- Strict Content Security Policy (CSP).
- Cloudflare Turnstile (Captcha) integration.
- Signed Cookie grace period (verify once, share freely for 1 hour).
- Self-hosted Assets: No external CDN dependencies (FontAwesome, CodeMirror, PrismJS are all local).
- Modern UI: Dark mode support and polished interface.
| Variable | Type | Description | Source |
|---|---|---|---|
DB |
Binding | D1 Database connection | wrangler.jsonc |
TURNSTILE_SITE_KEY |
Var | Public Turnstile key | wrangler.jsonc |
TURNSTILE_SECRET_KEY |
Secret | Private Turnstile key | wrangler secret put |
COOKIE_SECRET |
Secret | Key for signed cookies | wrangler secret put |
- A Cloudflare account.
- Node.js & npm installed.
Create a D1 database:
bunx wrangler d1 create SHARE_DBUpdate wrangler.jsonc with the database_id returned from the command.
Initialize the schema:
bunx wrangler d1 execute SHARE_DB --remote --file=./schema.sql-
Configure Secrets: The following sensitive variables must be set manually via Cloudflare Secrets:
# Secret for signing cookies (use a long random string) bunx wrangler secret put COOKIE_SECRET # Turnstile Secret Key from Cloudflare Dashboard bunx wrangler secret put TURNSTILE_SECRET_KEY
-
Configuration: Copy
wrangler.jsonc.exampletowrangler.jsoncand updatedatabase_idandTURNSTILE_SITE_KEY. -
Deploy:
bun run deploy
# Install dependencies
bun install
# Run dev server
bun run devMIT