Back to Projects
URL Shortener & Analytics

TrimLink

Shortens links and tracks click, country, and device metrics.

The Problem

Long links are hard to share and give no visibility into who's interacting with them.

The Solution

TrimLink turns long URLs into unique short links and anonymously logs clicks, country (by IP), and device type.

Architecture / Engineering

  • Implemented short-link redirection using Next.js Middleware at the edge.
  • Designed the analytics schema in Supabase to log clicks without storing personally identifiable data.
  • Built country resolution by IP and device-type detection from the user agent.
  • Generated unique short IDs with collision checking.

Key Features

  • Short-link redirection via edge Middleware.
  • Unique short ID generation with collision checking.
  • Click, country (by IP), and device-type logging.
  • Aggregated analytics without storing personally identifiable data.

Engineering Challenges

  • Resolving the redirect at the edge (Middleware) without penalizing the short link's latency.
  • Designing the analytics schema to capture useful signals (country, device) without storing PII.

Result / Current State

Deployed. Shortens links and exposes their usage metrics (clicks, country, device) in real time.

Stack

Next.jsMiddlewareTypeScriptTailwind CSSSupabase
LiveGitHubView all projects →