Buyers pay for links that outlive them — a domain someone else renews forever, branded short domains, and analytics history — because a self-hosted redirector dies the day you stop paying the VPS bill, taking every printed QR code with it.
REPLACEMENT BRIEF
analytics
Can AI replace Bitly?
A short-link redirect with click logging and QR generation is a classic one-sitting build — this category is the canonical weekend project. What the subscription buys is permanence and recognition: links on a domain that outlives your infrastructure, branded domains, analytics at scale, and a link that people trust enough to click.
Reviewed · DeepFeather editorial
known limits links that outlive your own infrastructure · a domain you stop renewing takes every link with it; bit.ly's recognition in the link itself, which cuts both ways now that shorteners get spam-filtered
Map a short slug to a destination, 302 to it, log the click with device and country, and render a QR code for any link.
Build the personal version →AT A GLANCE
- price
- $35/mo
- listed annual price
- $420/yr
- replaceable scope
- Map a short slug to a destination, 302 to it, log the click with device and country, and render a QR code for any link.
- build time
- 2–4 h
Build promptreviewed prompt · not run
the prompt
Curated promptBuild me a link shortener with click analytics and QR codes to replace Bitly. Requirements:
- Cloudflare Workers via wrangler: KV for the slug lookup, D1 for the click
log. Free tier, and it runs on my own domain.
- A worker on go.mydomain.com/{slug} reads KV and 302s, writing the click to
D1 inside ctx.waitUntil so the redirect never waits on the database.
- Slugs are random 6-character base62 by default, but I can set a custom
back-half, and creating one that already exists fails loudly instead of
overwriting it.
- Log per click: slug, timestamp, country and city from request.cf,
device type parsed from the user-agent, and referer.
- Generate a PNG QR code for any link with the qrcode npm package, served at
/qr/{slug} and cached, so print material points at the same tracked link.
- Optional expiry and a click cap per link · past either, 302 to a fallback
URL I set instead of returning a 404.
- An /admin page behind one password (wrangler secret) listing links with
clicks per day, plus top countries and device split per link.
- Secrets via wrangler secret, never in wrangler.toml. No accounts, no
third-party analytics, no telemetry.
- README: wrangler setup, the KV namespace and D1 database, the DNS record,
and a warning that these links die with the domain, so use a domain you
intend to keep renewing.The prompt stays readable first. Choose a launch option when you are ready.
$ open in your agent (prompt prefilled, you press enter) or copy it raw
Build Pack
Build a Bitly replacement: the plan
What to build, what to skip on purpose, and how to tell it works. Use any agent or prompt you like — the acceptance tests decide whether it worked.
- Estimated time
- 2–4 h
- Estimated monthly cost
- $0–5/mo
- Subscription, for contrast
- $35/mo · Growth
Editorial estimate, not a measured run · Reviewed · the subscription recurs monthly with none of your hours; the build costs one-time hours first
In scope
- A redirect worker on your own domain: /{slug} looks the slug up in KV and 302s to the destination
- Random 6-character base62 slugs, plus custom back-halves that refuse to overwrite an existing slug
- A per-click log in D1 (slug, time, country, city, device type, referer) written without delaying the redirect
- A cached PNG QR code for every link at /qr/{slug}
- Optional expiry date and click cap that send visitors to a fallback URL you choose instead of a 404
- A single-password /admin page with clicks per day, top countries and device split per link
Non-goals
- User accounts, teams or a public sign-up flow
- Link-in-bio or landing pages
- Campaign grouping, UTM builders or third-party integrations
- Spam or phishing screening of destinations — only you create links
- An uptime promise: if the domain lapses, every link dies with it
Recommended stack
- Runtime
- Cloudflare Workers (wrangler)Edge redirects with a free tier, on your own domain
- Slug lookup
- Workers KVRead-heavy key → destination lookups close to the visitor
- Click log
- Cloudflare D1 (SQLite)Queryable by slug and day for the dashboard
- QR codes
- qrcode npm packagePNG generation inside the worker, cached per slug
- Secrets
- wrangler secretThe admin password never lands in wrangler.toml or git
Data model
KV value per slugdestinationcreatedAtexpiresAt?clickCap?fallbackUrl?Optional fields only exist on links that use themD1 table clicksidslugtscountrycitydevicerefererIndex on (slug, ts); capped links count their rows here before redirecting
Steps
- Scaffold and bindCreate the worker with wrangler, a KV namespace and a D1 database, bind both in wrangler.toml, and set the admin password with wrangler secret put.
- Click schemaAdd a D1 migration for the clicks table with an index on (slug, ts).
- Redirect pathGET /{slug}: read KV, 302 to the destination, and write the click inside ctx.waitUntil. Unknown slug → 404; expired or over its cap → 302 to the fallback URL.
- Create linksAn admin-only POST that makes a random base62 slug or accepts a custom back-half, and fails loudly if the slug already exists.
- QR endpoint/qr/{slug} returns a PNG of the short URL with a long Cache-Control so print material keeps pointing at the tracked link.
- Admin dashboardPassword-protected /admin listing links with clicks per day, top countries and device split, aggregated from D1.
- Domain, deploy, READMERoute a subdomain (e.g. go.yourdomain.com) to the worker, deploy, and document setup plus the warning that links die with the domain.
Acceptance tests
- Visit go.yourdomain.com/{slug}A 302 to the destination, and a new clicks row in D1 within seconds
- Create a custom back-half that already existsAn error; the original destination is unchanged
- Scan /qr/{slug} with a phoneIt opens the same tracked short link
- Set a click cap of 1 and visit twiceThe second visit lands on the fallback URL, not a 404
- Open /admin without the password401; with it, per-day clicks and the country/device split render
- Search the repo and wrangler.toml for the admin passwordNot found — it exists only as a wrangler secret
Only you can do this
- Own a domain you intend to keep renewing and point a subdomain at the worker
- Create the Cloudflare account and run wrangler login (it opens your browser)
- Choose the admin password and store it with wrangler secret put
- Decide what to do with existing bit.ly links — they keep pointing at Bitly
What drives the cost
Personal volume fits the Workers Free plan (100,000 requests a day; KV 1,000 writes a day; D1 100,000 rows written a day). Past that, Workers Paid starts at $5 a month per account. The domain itself is extra and not included.
Cost sources: developers.cloudflare.com (checked )
what AI can build
Map a short slug to a destination, 302 to it, log the click with device and country, and render a QR code for any link.
The prompt was editor-reviewed; no completed build is recorded.
The honest tradeoff
why people still pay
what you lose
xlinks that outlive your own infrastructure · a domain you stop renewing takes every link with it
xbit.ly's recognition in the link itself, which cuts both ways now that shorteners get spam-filtered
xbundled QR code management, landing pages, and campaign grouping
xcity-level and device-level analytics rollups without building them
xan SLA and someone to call
Start with existing software
prior art · use these instead of building, if you'd rather
EVIDENCE LEDGER
What this page can prove
The verdict judges replaceability. The evidence level records what DeepFeather actually checked.
The prompt was editor-reviewed; no completed build is recorded.
Growth · monthly
known limits · links that outlive your own infrastructure · a domain you stop renewing takes every link with it; bit.ly's recognition in the link itself, which cuts both ways now that shorteners get spam-filtered
BUILD FEEDBACK
Did you try this build?
Report the outcome. Submissions enter a manual evidence queue and never auto-upgrade the verdict.
Want next week’s replacements?
New verdicts + most-wanted, weekly. Free. Unsubscribe anytime.
Share this verdict
questions
Can AI replace Bitly?
Likely for the core workflow. This is an editorial catalog judgment, not a verified build; validate any result against your own acceptance criteria.
How much does Bitly cost?
Bitly is listed at about $35/month (Growth, checked 2026-07-30), or $420 per year. This is a pricing reference, not evidence of a completed replacement or realized savings.
What do I lose by replacing Bitly?
Honestly: links that outlive your own infrastructure · a domain you stop renewing takes every link with it; bit.ly's recognition in the link itself, which cuts both ways now that shorteners get spam-filtered; bundled QR code management, landing pages, and campaign grouping; city-level and device-level analytics rollups without building them; an SLA and someone to call. If any of those are load-bearing for you, keep paying.
Is there an open-source alternative to Bitly?
Yes — Dub (The most complete open-source link platform · analytics, custom domains, QR codes. Self-hostable.), Shlink (Self-hosted URL shortener with a REST API, click stats, and QR codes.), YOURLS (The long-running PHP shortener · drop it on any LAMP host and it works.). Using prior art is also a valid exit; the prompt is for when you want it exactly your way.