Skip to content
SHWRK
CloudflareWorkersbuilding in public

Two tiny Cloudflare Workers, one afternoon

A live status page and a link shortener for shwrk.com, each a single small Worker on its own subdomain. Here is how they work.


When you run a handful of small sites, two bits of plumbing pay for themselves quickly: a status page so you know when something is down, and a link shortener so you can hand out clean URLs. Both turned out to be tiny on Cloudflare Workers, so I shipped them on the same afternoon.

status.shwrk.com

The status page checks every app’s home page live, the moment you load it. No database, no cron, no history. Just a Worker that fetches each URL server-side in parallel and renders an up or down summary.

The whole thing is one list and one fetch loop:

  • A TARGETS array of name and URL pairs.
  • A fetch per target with an 8 second timeout, following redirects.
  • Anything under a 400 status counts as up; a thrown error or timeout counts as down.

Because the checks run on the server, there are no cross-origin headaches like you would hit doing this from a browser. The only nicety I added was a 10 second cache so a refresh storm cannot hammer my own apps.

go.shwrk.com

The shortener is even smaller. Links live in a version-controlled file, a plain map of slug to destination. A request to go.shwrk.com/<slug> looks up the slug and redirects. The bare domain sends you to the homepage, an unknown slug returns a small 404, and query strings pass straight through so tracking parameters survive.

Redirects are 302 by default, which means I can change where a short link points later without browsers having cached a permanent answer. If I ever want a link to pass authority, flipping it to 301 is a one line change.

Why subdomains, not subfolders

Both run as custom-domain Workers, which means Cloudflare provisions the DNS record and certificate automatically since the zone already lives in the account. Subdomains made sense here because these are tools, not content I want ranking. The products themselves are a different story, and that is where subfolders earn their keep.

Small infrastructure like this is the unglamorous part of building in public, but it is the part that makes everything else calmer.

More on what I am building over on the hub.