Back to projects
Full Stack2025

URL Shortener

Scalable REST Service

View Source

Overview

A production-grade URL shortening service with custom aliases, click analytics, TTL expiry, and token-bucket rate limiting. Handles 5K req/sec with zero error rate.

Architecture

Spring Boot REST API with PostgreSQL for persistence and Redis for in-memory short-code caching. Deployed on AWS EC2 behind an Application Load Balancer. Docker containerization for reproducible deployments.

Tech Stack

Spring BootJavaPostgreSQLRedisDockerAWS EC2JUnitJMeter

Challenges

  • ▸Designing collision-resistant Base62 encoding at scale
  • ▸Achieving sub-5ms redirect latency via Redis in-memory caching
  • ▸Token-bucket rate limiting to prevent abuse
  • ▸Load testing to validate 5K req/sec throughput on EC2

Lessons Learned

Redis is uniquely suited for low-latency key-value lookups
JMeter load tests should be run early and often, not as an afterthought
Application Load Balancers simplify horizontal scaling on AWS
JUnit tests on core business logic catch regressions fast