Skip to content

Introduction

shrtnr is a free, open-source, self-hosted URL shortener built on Cloudflare Workers + D1. It has built-in AI integration, click analytics, and an admin dashboard. It runs on Cloudflare's free tier: no servers, no monthly cost.

Core philosophy

Most URL shorteners either lock you into a SaaS with per-click pricing or require you to operate a VPS. shrtnr takes a different route:

  • Zero servers: the whole app is a single Cloudflare Worker, backed by a D1 (SQLite) database and a KV namespace.
  • Zero monthly cost: it runs within the Cloudflare free tier by default.
  • You own your data: you own your data, domain, and short links, and can export or migrate at any time.

It takes one click to deploy. You then get a full admin UI, click analytics, TypeScript / Python / Dart SDKs, and an MCP server for AI assistants, all from the same Worker.

About this fork

Independently maintained fork

This repository (wyf9/shrtnr) is a fork maintained independently on top of the upstream oddbit/shrtnr, with custom features and enhancements. It diverges from upstream in design philosophy and is maintained as a separate project rather than a pull request back upstream.

The upstream shrtnr is built by Oddbit, a senior-led studio shipping Cloudflare, Firebase, Flutter, and AI integrations for funded startups and scale-ups.

Tech stack

ComponentPurpose
Cloudflare WorkersRuntime that handles every request (redirects, admin UI, API, MCP)
Cloudflare D1SQLite database storing links, slugs, click events, etc.
Cloudflare KVHigh-speed cache for slug-to-link lookups
HonoWeb framework, paired with @hono/zod-openapi to generate the API spec
Durable ObjectsHosts MCP agent sessions
ZodRequest/response schema validation that also drives OpenAPI generation

Request routing overview

The app dispatches by route prefix:

RoutePurposeAuth
/<slug>Short-link redirectPublic
/_/admin/*Admin UI and admin APIRequires external protection (see Access Control)
/_/api/*Public link-management APIBearer token
/_/mcp (and mcp.<domain>)MCP endpoint for AI assistantsOAuth (Cloudflare Access)
/_/healthHealth checkPublic

What's next

Released under the Apache License 2.0. Upstream built by Oddbit.