Skip to content

About

A high-throughput URL shortener built with FastAPI, Redis caching, and Docker.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

⚡ High-Performance URL Shortener (System Design)

Python Redis Docker

📖 Overview

A high-throughput URL shortening service (similar to Bitly) built to demonstrate modern backend System Design principles.

Although conceptually simple, this project implements a production-style architecture optimized for read-heavy workloads using an in-memory caching strategy to significantly reduce database latency.


✨ Key Features

  • Unique short URL generation
  • Redis-based caching using the Cache-Aside pattern
  • TTL-based automatic cache expiration
  • RESTful API with interactive Swagger documentation
  • Fully containerized using Docker Compose
  • Optimized for low-latency redirection

🏗 System Architecture

🔹 API Layer

Built with FastAPI for asynchronous and high-performance request handling.

🔹 Persistent Storage

SQLite / PostgreSQL used for durable, ACID-compliant URL storage.

🔹 Caching Layer (Performance Core)

Redis is used as an in-memory caching layer.

Mechanism: Cache-Aside Pattern

  • On request → Check Redis
  • On cache miss → Query database
  • Store result in Redis with TTL
  • Subsequent requests served from memory

This reduces disk-based database access to constant-time in-memory retrieval for frequent reads.

🔹 Containerization

Application and Redis services are orchestrated using Docker Compose.


🔄 Request Flow

Client
↓
FastAPI
↓
Redis (Cache)
↓ (on miss)
Database


🚀 How to Run

  1. Clone the repository:
    git clone https://github.com/yourusername/url-shortener-redis.git
    cd url-shortener-redis

About

A high-throughput URL shortener built with FastAPI, Redis caching, and Docker.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages