# Build brief — a focused alternative to ReSlug

> **Verdict:** Yes, for personal use · **Buildability:** 76/100 · **Category:** Analytics
> **Source:** https://www.canitbevibecoded.com/reslug
> Independent editorial assessment from Can It Be Vibe Coded? Not affiliated with, endorsed by, or derived from ReSlug. Verify current pricing and capabilities before acting.

## Context

**ReSlug** — Short links with click analytics, routing rules, QR codes, and bio pages. It currently costs $9/mo.

The redirect is a slug, a lookup, a 302, and a row in a table · Cloudflare Workers with KV and D1 does the whole job on the free tier, and the QR code is one library call. Routing rules, expiry, and password links are an afternoon more. What you cannot build in a sitting is permanence: your links only outlive the project if you keep renewing the domain and the account. The wrinkle with ReSlug specifically is that its free plan already includes a custom domain and real analytics at personal scale, so the DIY build is competing with 0 USD rather than 9 · build it for the ownership, not the savings.

This brief describes a focused, single-operator replacement for the part of ReSlug that is genuinely reproducible. It is deliberately narrower than the product it replaces, and it says so in writing. Build the useful core; do not pretend to have rebuilt the rest.

## What you are building

Map a short slug to a destination, 302 to it, log each click with country, device, and referrer, filter obvious bots, and render a QR code for any link.

- Ingest a known data source, calculate a focused metric set, and render a useful dashboard.
- A responsive interface with real empty, loading, success, and error states.

## Requirements

### Functional

- Cloudflare account (Workers, KV, D1).
- A domain you control.
- Wrangler CLI.

### Non-functional

- Accessibility: semantic markup, labelled controls, visible focus, and reduced-motion support.
- Security: server-side secrets, validated input, and no credentials in the client bundle.
- Reliability: retries with backoff on external calls, and a clear failure state when a provider is down.
- Portability: the operator can export their data and leave without losing it.

## Implementation brief

Build me a link shortener with click analytics and QR codes to replace ReSlug. Requirements:

- Cloudflare Workers via wrangler: KV for the slug lookup, D1 for the click
  log. Free tier, and it runs on my own domain.
- A worker on go.mydomain.com/{slug} reads KV and 302s, writing the click to
  D1 inside ctx.waitUntil so the redirect never waits on the database.
- Slugs are random 6-character base62 by default, but I can set a custom
  back-half, and creating one that already exists fails loudly instead of
  overwriting it.
- Log per click: slug, timestamp, country and city from request.cf, device
  type parsed from the user-agent, and referer. Drop clicks whose user-agent
  matches a known bot list before they reach the stats.
- Per-link routing rules: an optional country-to-URL and device-to-URL map
  checked before the default destination.
- Optional expiry date, click cap, and password per link · expired or capped
  links 302 to a fallback URL I set, password links show a minimal form first.
- Generate a PNG QR code for any link with the qrcode npm package, served at
  /qr/{slug} and cached, so print material points at the same tracked link.
- An /admin page behind one password (wrangler secret) listing links with
  clicks per day, top countries, top referrers, and device split per link.
- Secrets via wrangler secret, never in wrangler.toml. No accounts, no
  third-party analytics, no telemetry.
- Out of scope: bio pages, teams, and a public API.
- README: wrangler setup, the KV namespace and D1 database, the DNS record,
  and a warning that these links die with the domain, so use a domain you
  intend to keep renewing.

## Delivery standard

- Inspect the repository first, then write a short implementation plan before writing code.
- Deliver the smallest complete end-to-end workflow first; every primary control must work against persisted data.
- Use real validation and storage; never substitute fake dashboards, decorative controls, hard-coded success states, or mock integrations.
- Include responsive layouts plus genuine empty, loading, success, validation, and failure states.
- Keep secrets server-side in environment variables, provide .env.example, and never commit credentials or user data.
- Add structured logs around every external call and return actionable errors without leaking sensitive details.
- Write unit tests for the core logic and one automated test of the main user journey.
- Finish with a README covering setup, architecture, data location, backups, tests, deployment, and known limitations.

## Acceptance criteria

- [ ] A clean install starts the app using only the README and .env.example.
- [ ] The primary journey works from first visit through saved result, reload, edit, export, and deletion where applicable.
- [ ] Invalid input, missing configuration, provider failure, and an empty database each have a usable state.
- [ ] The interface works at 390px and 1440px, is keyboard navigable, and shows visible focus on every control.
- [ ] Tests, type checking, linting, and a production build all pass with no ignored failures.
- [ ] No part of the interface implies a live integration, security guarantee, or scale capability that was not actually built and verified.

## Non-goals

Do not build these, and do not claim to have replaced them:

- Links that outlive your own infrastructure · a domain you stop renewing takes every link with it.
- Bot filtering that actually works · the heuristics take iteration you will not do for one project.
- Geo and device routing rules, scheduled links, and click caps behind a dashboard instead of a config file.
- Bio pages and branded QR codes.
- A REST API and webhooks other tools can call.

## What you still own after launch

- Run migrations, backups, restores, and dependency updates.
- Test the critical journey after every model, API, or hosting change.
- Monitor failures and fix the edge cases a first prompt will miss.

## Risk

**Operational risk.** The code is achievable; dependable data, integrations, and ongoing operations are the real cost.

Editorial confidence in this assessment: high. No reviewed project implementation is linked yet.

## Existing alternatives

Before building, compare these checked options:

- [Short.io](https://short.io/pricing/) — Short links, analytics, QR codes, mobile routing and link-in-bio pages on a genuinely useful free plan

## Prior art

Working open-source software you can read, fork, or borrow from before starting:

- [Dub](https://github.com/dubinc/dub) — The most complete open-source link platform · analytics, custom domains, QR codes. Self-hostable
- [Shlink](https://github.com/shlinkio/shlink) — Self-hosted URL shortener with a REST API, click stats, and QR codes
- [YOURLS](https://github.com/YOURLS/YOURLS) — The long-running PHP shortener · drop it on any LAMP host and it works

---

Generated by [Can It Be Vibe Coded?](https://www.canitbevibecoded.com) · Full report: https://www.canitbevibecoded.com/reslug
