feat: Plummer — Cloudflare Workers link shortener#1
Conversation
Agent-Logs-Url: https://github.com/SillyLittleTech/plummer/sessions/805f3bef-3856-4c98-a338-708cb224edcd Co-authored-by: kiyarose <75678535+kiyarose@users.noreply.github.com>
|
@copilot Wait, so where do I get the Github secrets, |
Great questions — here's a breakdown of each: GitHub Actions secrets ( Both come from the Cloudflare Dashboard:
Once you have both values, go to this repo → Settings → Secrets and variables → Actions → New repository secret and add each one by name.
This is a Wrangler secret (stored encrypted on Cloudflare, not in GitHub), so you don't add it to GitHub Actions. Preview KV namespace — do you need it? No, it's optional. You only need the preview namespace if you want to use Setting up Three things need to be true:
If the zone is already on Cloudflare (which it is for sillylittle.tech), step 3 is just adding the DNS record and deploying. |
|
@copilot How to setup preview KV? Can we skill custom domain setup for now and still test until we are ready for prod? |
Yes, you can absolutely skip the custom domain and test using the default Setting up the preview KV namespace Run this once in your terminal (you need to be logged in with npx wrangler kv namespace create LINKIVERSE --previewIt will print something like: Copy that [[kv_namespaces]]
binding = "LINKIVERSE"
id = "your-production-namespace-id"
preview_id = "abc123..." # ← paste the preview id hereThat's it — Testing without a custom domain Yes, skip the When you're ready to add |
|
@copilot Do I need to uncomment [[routes]] if I am not adding a custom domain at this time, how do I build to test. |
No, leave To test locally (recommended first step): npm install # install wrangler if you haven't yet
npx wrangler dev # starts a local dev server at http://localhost:8787
To deploy to Cloudflare and test on a real URL: npm run deployAfter deploy, the CLI will print a URL like |
|
@copilot can we comment out the code for the local /admin password stuff, we will be likely locking this endpoint behind CF access, while the MAIN page is still public. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
plummer | 2dfe580 | Commit Preview URL Branch Preview URL |
May 01 2026, 05:59 AM |
Implements the Plummer link shortener as a single-file Cloudflare Worker backed by a KV namespace (
LINKIVERSE). Designed as both an internal tool (share.sillylittle.tech) and a forkable template.Worker (
src/index.js)GET /homepage,GET /admindashboard (Basic Auth),GET|POST /:slugredirect handler,REST /api/linkswaitUntil) → 302GET /api/links,POST /api/links,DELETE /api/links/:slug; slug validated to[a-zA-Z0-9_-]{1,64}, reserved slugs blocked, destination URL must behttp(s)ADMIN_SECRETWrangler secret; timing-safe comparison via SHA-256 + constant-time XOR to avoid length/timing leaksX-Content-Type-Options,X-Frame-Options,Referrer-Policyon every response;onclickvalues useJSON.stringify+escHtmlto prevent XSS injectionlocalStoragepersistenceKV schema — key:
link:{slug}{ "slug": "my-link", "guest": "https://example.com", // destination URL "passwordHash": null, // SHA-256 hex, or null "expiresAt": null, // Unix ms timestamp, or null "clicks": 42, "createdAt": 1714500000000 }Infrastructure
wrangler.toml— KV binding + commented[[routes]]stub forshare.sillylittle.techpackage.json— wrangler v4.86.0 (patched; v3 line had a known CVE).github/workflows/deploy.yml— deploys to Workers on push tomainRequired setup (first deploy)
Full instructions in the updated
README.md.Original prompt