Vibecode Dub

track this build5 phases, 10 steps, beginner friendly
YES · one-shottable
price $90/moyou'd save $1,080/yrbuild time one sittingcategory 📈 seo & marketingreplaced by 0 people

A short link is a row and a 302. Click analytics is the Linktree /go pattern with a country and referrer column. Dub is also open source, so the honest ceiling is self-hosting it; the DIY is for when you want the 200-line version on your own domain.

the project pack5 files · written for this build, step by step
README.md
# Dub · indie build

A link shortener on your own domain with click analytics: CSPRNG slugs, a redirect that never waits on the database, clicks with country, referrer and device but no raw IP, a private admin with per-link stats, a token API, and QR codes. Dub itself is open source; this is the 200-line version for one person and a domain you will keep forever.

Estimated effort: **one sitting**. Work `BUILD_PLAN.md` top to bottom · every phase ends in a check that has to pass before the next one starts.

## Stack

| Part | Choice | Why |
| --- | --- | --- |
| Runtime | Node 22, node:http and node:sqlite | a row and a 302 |
| Hosting | A VPS behind Caddy on a domain you will keep | a shared short link outlives the tool |

## Before you start

Have every one of these ready. The plan assumes them from step one.

- [ ] **Node.js 22 or newer** · free
  - Why: Everything in this build runs on it: the server, the scripts, the tests.
  - Get it: Download the LTS installer from nodejs.org, or install with your package manager (brew install node, or nvm install 22). Restart the terminal afterwards.
  - Verify: node --version prints v22 or higher
- [ ] **A terminal and a code editor** · free
  - Why: Every step below is a command you type or a file you edit.
  - Get it: VS Code (code.visualstudio.com), Cursor or Zed. Open a folder for the project and use the editor's built-in terminal.
  - Verify: You can open a folder and run a command in its terminal
- [ ] **Git** · free
  - Why: History for your code, and the way most hosts deploy.
  - Get it: Install from git-scm.com or with your package manager, then run git init in the project folder once it exists.
  - Verify: git --version prints a version
- [ ] **A short domain you will keep for years** · roughly $10 to $30 a year
  - Why: Every link you share depends on it. Auto-renew on.
  - Get it: A short .co, .link or .to at Porkbun or Cloudflare Registrar; turn on auto-renew.
- [ ] **A random salt for hashing IPs** · free
  - Why: Click rows store hashes.
  - Get it: openssl rand -hex 32.
- [ ] **An API token for scripts** · free
  - Why: Phase 4 exposes a token-protected API.
  - Get it: openssl rand -base64 32 into .env as API_TOKEN.
- [ ] **A small always-on server (VPS)** (optional) · about $5 a month
  - Why: This needs one process running all the time with a public address.
  - Get it: Hetzner Cloud (from about 4 EUR), DigitalOcean or Fly.io. Ubuntu 24.04, the smallest size. You need SSH access and a public IP. Only needed for the deploy phase; develop locally first.
- [ ] **Caddy on the server** (optional) · free
  - Why: Automatic HTTPS in front of the Node process. Without TLS the browser features this relies on (and your visitors' trust) do not work.
  - Get it: On the VPS: follow the install steps at caddyserver.com/docs/install for Ubuntu. One Caddyfile with your domain and a reverse_proxy line is the whole config.
  - Verify: caddy version prints a version on the server

## Quick start

```sh
mkdir shortener && cd shortener && git init && npm init -y && npm pkg set type=module
mkdir -p data && cp .env.example .env
```

Then copy `.env.example` to `.env` and fill in the values it documents.

## Honest limits

This build deliberately does not replace:

- Conversion tracking, partner payouts, workspaces: the $90 product.
- partner and affiliate payouts
- conversion tracking through to revenue
- team workspaces and folders
- the polished analytics dashboard and API

If one of those is essential to you, that is the reason to keep paying for Dub, and the README should say so rather than pretend.

$ choose a build depth, inspect the files, then open the complete pack in your agent

why people still pay

Nobody pays $90 for short links. They pay for attributing signups and revenue to links and paying partners from that data, which is a finance product wearing a shortener.

what you lose

xpartner and affiliate payouts

xconversion tracking through to revenue

xteam workspaces and folders

xthe polished analytics dashboard and API

prior art · use these instead of building, if you'd ratherDubthe product itself is open sourceShlinkself-hosted URL shortener
share on X ↗"I just replaced Dub ($90/mo) with one prompt"
questions
Vibecode Dub

Yes. A competent AI coding agent (Claude Code, Codex, Cursor) can build a usable personal Dub replacement in one session with the prompt on this page. It runs on your own machine or server with no subscription.

How much does Dub cost?

Dub costs about $90/month (Business, checked 2026-09-04), which is $1080 per year. That's what you save by replacing it with one prompt.

What do I lose by replacing Dub?

Honestly: partner and affiliate payouts; conversion tracking through to revenue; team workspaces and folders; the polished analytics dashboard and API. If any of those are load-bearing for you, keep paying.

Is there an open-source alternative to Dub?

Yes: Dub (the product itself is open source), Shlink (self-hosted URL shortener). Using prior art is also vibecoding; the prompt is for when you want it exactly your way.