Url-Shorten-Worker is a free, open-source (MIT) URL shortener and pastebin that runs entirely on Cloudflare Workers + Workers KV. The whole backend is a single index.js file — deployment takes about 5 minutes: create a KV namespace, paste the code, bind a domain. On the Workers free tier it costs $0/month to run.
Features: custom slugs, per-link expiry, built-in CAPTCHA on link creation, pastebin mode storing up to 10 MiB texts with a ?raw=1 raw view, optional Google Safe Browsing screening, and docs in English and Chinese. No database server to manage — it scales automatically with traffic.
Repo: https://github.com/xyTom/Url-Shorten-Worker
Live demo of the code: https://lnks.eu.org
Comments
Add a CommentDoes per-link expiry also remove the stored pastebin text, or only disable the short URL? For the raw-text view, it would be useful to document whether expiry and deletion revoke access immediately and how a self-hosted operator can verify that behavior.
its really helpful to me
A single index.js on Workers KV keeps this very easy to deploy. With the pastebin mode holding up to 10 MiB texts, how do you handle KV's eventual consistency, for example a link that was just created but is not yet readable from another region?