Everyone thinks a URL shortener is a weekend project. Take a long URL, store it with a short code, redirect. Done.
I thought so too. That's how SendURL started. [One line of your own: why you started it, e.g. what annoyed you about the tools you were using.]
The redirect took an afternoon. Everything around it has taken months. Here are the parts that surprised me.
1. A QR code is a promise you can't take back
Every SendURL link gets a QR code. Early on I realised something uncomfortable: once someone prints that code on a menu, a flyer or a box, I can never change what it encodes. A typo in the URL format, a domain change, a "small refactor" of how short links are built, and thousands of printed codes break forever.
So the rules became strict. The short domain never changes. A link's slug and domain can never be edited. To tell a scan apart from a click, the QR code encodes the same short link with a tiny ?q flag. The redirector sees the flag, records the click as a scan and drops the flag before redirecting. One small character, frozen forever.
Most code you can fix tomorrow. Printed code you can't.
2. Caching is easy. Un-caching is the job.
Redirects must be fast, so link lookups sit in Redis. The hard part is deleting the cached entry at the right moment when a user edits a link.
The race I hit: a redirect reads the old row from the database just before an edit commits, then writes that old row back into the cache right after I deleted it. The user changes their link, and visitors keep going to the old page.
The fix is almost embarrassingly simple: delete the key, then delete it again two seconds later. And never write visit counts back into the cache, because every write-back is another chance to bring a stale entry back to life.
3. Analytics queries get slow quietly
Click analytics looks like a GROUP BY. It is, until one customer has millions of clicks and the dashboard starts timing out.
What worked:
- Every analytics query starts from the user's own links, then reads clicks per link from a covering index that holds exactly the columns the charts need. Postgres never touches the table itself, only the index.
- I stopped parsing the full Referer header at query time. The redirector stores just the referring host when the click happens, so "where did my clicks come from?" stays an index-only read.
The best one: the city breakdown was taking almost 8 seconds on a cold cache in production, because city wasn't in the index and every row needed a trip to the table. One narrow extra index, built concurrently so no click was ever blocked, and it became index-only like everything else.
4. I wrote my own MCP server instead of using the SDK
SendURL has an MCP server, so ChatGPT, Claude or Cursor can create links and read stats for you. When I built it, the official SDK didn't support the newest protocol version yet and wanted a different Express version than mine.
A tools-only, stateless server turned out to be a few hundred lines. There are no sessions and no streams: one JSON answer per request. Each tool simply calls the same REST route a developer would. If an API key can't do something, neither can the AI using it.
5. The boring features are the ones people use
I love the A/B tests and the app-store routing. But the feature people thank me for is that the redirect goes straight to their page: no ads, no "you're being redirected" screen, no five-second wait.
What it is today
SendURL does short links on your own domain, QR codes, click analytics, folders and tags, UTM building, A/B tests, mobile app targets, a REST API on every plan and that MCP server.
If you've built something with a "simple" core, I'd love to hear which part turned out to be the real work. And if you want to poke at a URL shortener built by someone who has been bitten by all of the above: sendurl.to
