portfolio
← PROJECTS
Screenshot of Kotaa
Web · 2022

Kotaa

An open-source, self-hostable URL shortening service powered by Redis — 70–80% faster redirects than a traditional database-backed shortener.

SvelteKitRedisSupabaseVercel Edge

Kotaa is an open-source, self-hostable URL shortening service built to be blazingly fast. The core idea: use Redis as the primary lookup store for redirects, which pushes performance up by 70–80% compared to a traditional database-backed shortener.

The performance architecture

Most URL shorteners work like this: request comes in → query a database → redirect. The database query is the bottleneck — even a fast Postgres query adds 10–50ms of latency on each redirect.

Kotaa flips the hot path: redirect lookups go to Upstash Redis (a globally-distributed, serverless Redis), which resolves in single-digit milliseconds. Writes (creating or deleting links) go to Supabase Postgres, which stays the source of truth and keeps Redis in sync.

This split — Redis for reads, Postgres for writes — is the reason for the 70–80% speed improvement. The redirect path never touches a relational database.

Edge deployment

Redirects run as Vercel Edge Functions, which execute at the CDN node closest to the user rather than at a central server. Combined with Upstash’s global distribution, a link click resolves as close to the user’s location as possible — no roundtrips to a home region.

Tech stack

The frontend and API are built with SvelteKit. Supabase provides Postgres and the auth layer for the admin interface (so only you can manage your links). Upstash Redis handles the redirect lookup store via its HTTP API, which is the only Redis client that works inside Vercel’s edge runtime.

Key learnings

This project made Redis caching genuinely concrete for me — not as an abstract “make things faster” layer, but as a specific architectural decision with clear tradeoffs. Understanding when to put Redis in front of Postgres, how to keep them in sync, and what happens when they diverge are lessons that show up in every performance-sensitive project since.

The source is open on GitHub. Self-hosting takes about five minutes.