All Projects
Web

LinkSnap — URL Shortener with Analytics

A free URL shortener that generates short links and QR codes instantly — with private click analytics tracking country, device, browser and time. No signup required to start.

Next.js 14TypeScriptPostgreSQLSupabaseRedisUpstashRechartsVercel

What needed solving

Sharing long URLs is messy — they break in emails, look untrustworthy in messages, and give you zero information about whether anyone actually clicked them. Most free URL shorteners either show ads, require signup, or offer no analytics at all.

How I solved it

LinkSnap lets anyone shorten a URL instantly — no account needed. Every link gets a QR code automatically and a private analytics dashboard showing clicks by country, device, browser and time. The backend uses Redis for sub-10ms redirects and PostgreSQL for persistent analytics storage.

A look at the product

LinkSnap — URL Shortener with Analytics screenshot 1
LinkSnap — URL Shortener with Analytics screenshot 2
LinkSnap — URL Shortener with Analytics screenshot 3
LinkSnap — URL Shortener with Analytics screenshot 4

Key Features

  • Instant shortening — paste any URL, get a short link and QR code in under a second, no signup required
  • Private analytics — each link gets a secret token-protected analytics URL, so only the creator can view their stats
  • Click tracking — every redirect logs country, city, device, browser, referrer and timestamp asynchronously
  • Trial system — 2 free shortens per IP per 24 hours, with a premium upgrade modal encouraging account creation
  • Custom slugs & expiry — advanced options let users set a custom slug and link expiry of 24h, 7d, 30d or never
  • Rate limiting — Redis-backed IP rate limiting prevents spam with a 5 requests/hour cap in production

Architecture

  1. 01Dual storage strategy — Upstash Redis for the hot redirect path (cache hit = instant response), Supabase PostgreSQL for persistent URL and analytics storage
  2. 02Async click logging — redirects fire immediately while click data (IP geolocation, user agent parsing) is logged in a non-blocking background process
  3. 03Token-based analytics privacy — a UUID analytics token is generated at shorten time and stored in the database; the analytics page validates the token server-side before rendering any data
  4. 04Collision-proof slug generation — random 6-character slugs are checked against the database before use, with automatic retry and fallback to 8-character slugs if collisions occur
  5. 05IP hashing for privacy — raw IPs are never stored; a SHA-256 hash salted with the service role key is stored instead
  6. 06Environment-aware rate limiting — rate limits are set to 100/hour in development and 5/hour in production via NODE_ENV check

Results & Outcomes

Redirect latency under 10ms on cache hits via Upstash Redis in the Mumbai region

Full click analytics pipeline working end to end — country, device, browser and referrer all captured correctly

Token-based analytics protection successfully blocks unauthorized access while giving link creators full preview access

Trial system working correctly across browser sessions using localStorage with 24-hour reset logic tied to first use timestamp

Want a similar solution?

I'm available for new projects. Let's talk.