quickstart
clone, create a KV namespace, set the API token, deploy the Worker — live in a few minutes.
quickstart
You'll need Bun and a Cloudflare account (the free plan is enough —
Workers + KV). Auth for deploys is either wrangler login or a CLOUDFLARE_API_TOKEN in
your environment.
1. clone and install
2. run it locally
wrangler dev serves the Worker at http://localhost:8787 and hot-reloads on save. The
local API_TOKEN for the API comes from services/redirect/.dev.vars.
3. create the KV namespace
Zippy stores slug → destination in a single KV namespace bound as LINKS:
Paste both ids into services/redirect/wrangler.toml:
4. set the API token
The write/read API is gated by a Bearer token stored as a Worker secret (never a
[vars] value, never committed):
Closed by default
With no API_TOKEN configured, the API returns 401 for every request — writes are closed,
never open. Set the secret before you expect the API to work.
5. deploy
The script refuses to deploy while wrangler.toml still holds a REPLACE_WITH_KV
placeholder, typechecks first, then runs wrangler deploy.
6. create your first link
Open shortUrl on a phone and — because the destination is a known platform — Zippy tries
to open the X app, falling back to the web URL if it isn't installed. On desktop it's a
plain 301. See the API reference for the full request/response
shapes and the platforms list.
7. (optional) put it on a custom domain
BASE_URL (a [vars] value in wrangler.toml) builds the shortUrl in API responses —
set it to your domain's https origin so short links are correct. The custom-domain route
is commented in wrangler.toml; the full walkthrough is in
self-host on Cloudflare.