<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: SendURL Team</title>
    <description>The latest articles on DEV Community by SendURL Team (@sendurl).</description>
    <link>https://dev.to/sendurl</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4278317%2F2cc717d7-af51-4957-8b5e-a7de5c911a32.png</url>
      <title>DEV Community: SendURL Team</title>
      <link>https://dev.to/sendurl</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sendurl"/>
    <language>en</language>
    <item>
      <title>I built a URL shortener, and the hard part wasn't shortening URLs | SendURL</title>
      <dc:creator>SendURL Team</dc:creator>
      <pubDate>Wed, 02 Dec 2026 11:03:26 +0000</pubDate>
      <link>https://dev.to/sendurl/i-built-a-url-shortener-and-the-hard-part-wasnt-shortening-urls-sendurl-3pf7</link>
      <guid>https://dev.to/sendurl/i-built-a-url-shortener-and-the-hard-part-wasnt-shortening-urls-sendurl-3pf7</guid>
      <description>&lt;p&gt;Everyone thinks a URL shortener is a weekend project. Take a long URL, store it with a short code, redirect. Done.&lt;/p&gt;

&lt;p&gt;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.]&lt;/p&gt;

&lt;p&gt;The redirect took an afternoon. Everything around it has taken months. Here are the parts that surprised me.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. A QR code is a promise you can't take back
&lt;/h2&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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 &lt;code&gt;?q&lt;/code&gt; flag. The redirector sees the flag, records the click as a scan and drops the flag before redirecting. One small character, frozen forever.&lt;/p&gt;

&lt;p&gt;Most code you can fix tomorrow. Printed code you can't.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Caching is easy. Un-caching is the job.
&lt;/h2&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Analytics queries get slow quietly
&lt;/h2&gt;

&lt;p&gt;Click analytics looks like a &lt;code&gt;GROUP BY&lt;/code&gt;. It is, until one customer has millions of clicks and the dashboard starts timing out.&lt;/p&gt;

&lt;p&gt;What worked:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;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.&lt;/li&gt;
&lt;li&gt;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.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The best one: the city breakdown was taking almost 8 seconds on a cold cache in production, because &lt;code&gt;city&lt;/code&gt; 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.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. I wrote my own MCP server instead of using the SDK
&lt;/h2&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. The boring features are the ones people use
&lt;/h2&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it is today
&lt;/h2&gt;

&lt;p&gt;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. &lt;/p&gt;

&lt;p&gt;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: &lt;a href="https://sendurl.to" rel="noopener noreferrer"&gt;sendurl.to&lt;/a&gt;&lt;/p&gt;

</description>
      <category>buildinpublic</category>
      <category>sideprojects</category>
      <category>softwaredevelopment</category>
      <category>startup</category>
    </item>
  </channel>
</rss>
