Short links that delete themselves
I wanted my own link shortener, but not one whose database grows forever. So every link in Poof gets a lifetime, and the database removes it by itself, right on time.

I share long links from my phone all the time: a document for an afternoon, a video for an evening, my GitHub for good. A normal shortener keeps every one of those forever, so its database quietly fills up with links nobody will ever click again.
I wanted the opposite: short links that clean up after themselves.
Every link gets a lifetime
In Poof, you paste a link and pick how long it should live: 1 hour, 1 day, 7 days or 30 days. When the time is up, the link goes poof, and so does its entry in the database.
Later I added a fifth choice, forever, for the few links I really keep (my CV, my GitHub). Those stay until I delete them.
The clean-up that isn’t there
The obvious way to delete old links is a job that runs every night and removes everything that has expired. I didn’t want that: one more thing to run, to monitor, and to forget about.
Poof stores each link in Cloudflare KV, and KV can give every entry an expiry time:
await kv.put(`l:${code}`, JSON.stringify(link), {
expirationTtl: lifetime, // seconds; KV deletes the entry itself
metadata: { url, created, exp }, // so the list of links is one call
});
That’s the whole clean-up. No script, no schedule: the database removes each link at its exact time, not at the next nightly run. A forever link is simply saved without an expiry.
The best background job is the one you never have to write.
Only I can make links
A shortener anyone can use fills up with spam and phishing links fast. So every request that makes, lists or deletes a link needs my key. The server compares a hash of the key it received with a hash of the real one, in constant time, so how long the answer takes gives nothing away.
A few more small rules:
- only
httpandhttpslinks, neverjavascript:ordata: - a link can’t point back at Poof itself
- redirects are never cached and send no referrer
- an expired or unknown link shows a friendly “Poof, it’s gone” page
Testing time without waiting for it
How do you test that a 1-hour link disappears after an hour? You don’t wait an hour.
The tests run on a small stand-in for KV whose clock can jump ahead: make a 1-hour link, move the clock an hour, and check the link and its entry are gone. Move it ten years, and a forever link still works.
kv.now += 3600 * 1000 + 1; // one hour later
assert.equal(await resolveLink(kv, code), null);
assert.equal(kv.items.size, 0); // and the storage is empty again
What it costs
Nothing. Cloudflare Pages runs the page and the three small functions, KV holds the links, and the free plan is far more than one person’s short links will ever need.
The code is private, but I’m happy to show it to anyone curious.