Building a Self-Hosted URL Shortener with Cloudflare Workers
The Problem: Twitter’s 280-Character Limit When sharing technical blog posts on Twitter, I constantly hit the 280-character limit. Long URLs consume precious space that should be used for actual content. For example: Full URL with UTM: 155 characters https://iamdevbox.com/posts/building-complete-oidc-login-flow-urls/?utm_source=twitter&utm_medium=social&utm_campaign=blog_post Available for content: Only 125 characters This leaves barely enough room for a meaningful tweet. Third-party URL shorteners like Bitly work, but they: Cost money for custom domains ($29/month for Bitly Pro) Don’t give you full control over your data May inject their own analytics or tracking Could shut down and break all your links The Solution: Cloudflare Workers Cloudflare Workers is a serverless platform that runs your code at the edge, across Cloudflare’s global network. Combined with KV (Key-Value) storage, it’s perfect for building a URL shortener. ...