← Back to Work

01 / URL SHORTENER & ANALYTICS

LINKLYST

Linklyst is a URL shortening and link management app built with Next.js App Router, Prisma ORM, and PostgreSQL.

  • Next.js
  • Prisma ORM
  • PostgreSQL
  • Supabase
  • NextAuth
  • Tailwind CSS
  • Zod
  • QRCode
  • Vitest
  • Docker

01 / The Problem

Problem

Long URLs are hard to share and track, while basic URL shorteners run into code collisions under concurrent requests and slow database queries on frequent redirects.

02 / The Solution

Solution

Built a Base62 short-code generator backed by PostgreSQL unique constraints and bounded retries, an in-memory redirect cache, IP rate limiting, QR code exports, and click tracking.

03 / Architecture & Features

How it works

  1. 01

    Base62 Short-Code Generator

    Generates compact short codes backed by PostgreSQL unique constraints and bounded retry logic to avoid collisions.

  2. 02

    In-Memory Caching

    Caches frequently accessed short codes in memory so GET /[shortCode] redirects resolve without waiting on a database round-trip.

  3. 03

    Rate Limiting & Validation

    Protects link creation routes with IP rate limiting and Zod URL schema validation.

  4. 04

    Click Analytics & QR Codes

    Tracks click events (/api/analytics), manages user links with NextAuth, exports QR codes, and runs automated tests with Vitest.

04 / Features

Key features

  • Base62 short-code generation and custom aliases
  • HTTP redirection backed by an in-memory lookup cache
  • Click tracking and analytics endpoint (/api/analytics)
  • Downloadable QR codes for shortened links
  • NextAuth user sign-in and link management
  • Unit and integration tests running on Vitest

05 / Challenges

Implementation details

  • Preventing short-code collisions under concurrent requests using PostgreSQL unique constraints and bounded retries.
  • Applying IP rate limits and Zod URL validation without slowing down redirect routes.