A URL shortener and text-sharing service implemented as JavaScript on Cloudflare Workers, with KV storage, optional CAPTCHA, and a web UI.
Overview
Url-Shorten-Worker is a URL shortener designed for Cloudflare Workers. It keeps short links in a Workers KV namespace bound as LINKS and uses the worker script to serve redirects and management flows.
The homepage can shorten URLs and offers a Pastebin-style mode for sharing plain text, code snippets, and logs, with dark and light themes and file upload. Shared text opens on a reader page with copy, a line-wrap toggle, .txt download, and plain-text routes via ?raw=1 or /raw/:key. Paste size is checked in UTF-8 bytes against a configurable limit set below KV’s maximum.
CAP Worker integration can guard link creation and access with configurable rules and a degradation path when verification is unavailable. HTTP API documentation is maintained separately. Optional Google Safe Browsing checks can rely on a SAFEBROWSINGAPIKEY secret in worker settings.
To deploy, create a KV namespace, bind it to the worker, copy the project’s index.js into Cloudflare, and save. A public demo expires generated links after 24 hours; for ongoing use you should deploy your own instance.
Key features
- Short URL creation and redirects
- Pastebin text sharing
- Dual-mode web homepage
- CAPTCHA on create and access
- Workers KV link storage
- Documented HTTP API
- Optional Safe Browsing checks
- Plain-text raw output routes
Use cases
- Personal short-link service on Cloudflare
- Sharing code snippets and logs via pastebin
- API-driven URL shortening
- Bot-protected public shorten endpoints