System Design Problems
1 min read

URL Shortener Design: IDs, Storage, and Scale

A comprehensive guide to designing a scalable URL shortening service like bit.ly or TinyURL.

  • Generate short URLs from long URLs
  • Redirect short URLs to original URLs
  • Optional: Custom short URLs
  • Optional: Analytics and tracking
  • High availability
  • Low latency redirects
  • Scalable to billions of URLs

The system consists of:

  1. API Gateway: Handles incoming requests
  2. URL Service: Generates and manages short URLs
  3. Database: Stores URL mappings
  4. Cache: For frequently accessed URLs
  • Base62 encoding (a-z, A-Z, 0-9)
  • 7 characters = 62^7 = ~3.5 trillion unique URLs
  • NoSQL (e.g., DynamoDB, Cassandra) for high write throughput
  • Key-value store optimized for lookups

More detailed implementation notes coming soon…

Read more

  • Previous

    Design a Flash Sale System

    System Design / System Design Problems 23 min read

    Building a system to handle millions of concurrent users competing for limited inventory during time-bounded sales events. Flash sales present a unique challenge: extreme traffic spikes (10-100x normal) concentrated in seconds, with zero tolerance for inventory errors. This design covers virtual waiting rooms, atomic inventory management, and asynchronous order processing.

  • Next

    Design a Cookie Consent Service

    System Design / System Design Problems 25 min read

    Building a multi-tenant consent management platform that handles regulatory compliance (GDPR, CCPA, LGPD) at scale. Cookie consent services face unique challenges: read-heavy traffic patterns (every page load queries consent status), strict latency requirements (consent checks block page rendering), regulatory complexity across jurisdictions, and the need to merge anonymous visitor consent with authenticated user profiles. This design covers edge-cached consent delivery, anonymous-to-authenticated identity migration, and a multi-tenant architecture serving thousands of websites.