A cutting-edge URL shortener designed for speed and scalability, leveraging Django, Gunicorn, Redis, and PostgreSQL to deliver exceptional performance under heavy load.
This project handles 1000+ concurrent users and sustains 30,000+ requests per minute with minimal latency.
- Django: Robust web framework for rapid development and clean design
- Gunicorn: High-performance WSGI server for concurrent request handling
- Redis: In-memory caching to reduce response times
- PostgreSQL: Reliable relational database for URL mappings
- Nginx: Reverse proxy for traffic routing and static file serving
Microservice architecture with containerized components (Django API, Redis cache, PostgreSQL database, Nginx gateway) enabling horizontal scaling, independent deployment, and optimal resource utilization.
graph TD
User[User / Client] -->|HTTP Request| Cloudflare[Cloudflare DNS/Proxy]
Cloudflare -->|Load Balancing| Nginx[Nginx Reverse Proxy]
Nginx -->|Proxy Pass| Gunicorn[Gunicorn WSGI]
Gunicorn -->|Application Logic| Django[Django Backend]
Django -->|Read/Write| Redis[Redis Cache]
Django -->|Persist Data| DB[(PostgreSQL)]
subgraph Compose["Docker Compose Infrastructure"]
Nginx
Gunicorn
Django
Redis
DB
end
The system was stress tested using K6 on Azure Standard_F8s_v2 infrastructure:
- vCPUs: 8 cores
- RAM: 16 GB
- Concurrency: 1,000 Virtual Users (VUs)
- Duration: 60 seconds
| Metric | Value | Status |
|---|---|---|
| RPS (Requests per Second) | ~1,200 req/s | ✅ |
| P95 Latency | < 50ms | ✅ |
| Error Rate | 0% | ✅ |
| CPU Usage | 60-70% (Stable) | ✅ |
- Redis Caching: P95 latency maintained under 50ms thanks to efficient Redis caching strategy
- Zero Errors: 100% success rate under 1,000 concurrent users
- Optimal Resource Usage: CPU usage remained stable at 60-70%, indicating good headroom for scaling
- High Throughput: Sustained 1,200+ requests per second over 60-second test duration
Performance metrics from K6 dashboard during stress testing:

Docker container stats during peak load (1000VUs):

- High Performance Cache: Redis caching layer to minimize database hits and reduce latency
- Rate Limiting: Using Nginx to protect against abuse and block spam requests
- Dockerized Deployment: Containerized architecture for easy deployment and scalability
- CI/CD Pipeline: Automated testing and deployment using GitHub Actions
- Security: Use third-party services Cloudflare for DDoS protection and Turnstile for bot protection
- Base62 Encoding: Compact and user-friendly short URLs using Base62 algorithm
- PostgreSQL Database: Reliable data persistence with connection pooling
- Horizontal Scalability: Stateless architecture allows easy scaling with load balancers
- Navigate to
/s0/create/ - Complete the Cloudflare Turnstile verification
- Enter your long URL
- Receive your shortened URL
Simply visit /<short_code> to be redirected to the original URL. The system automatically:
- Checks Redis cache first (cache hit = <10ms response)
- Falls back to PostgreSQL if cache miss
- Updates cache for subsequent requests
| Endpoint | Method | Description |
|---|---|---|
/s0/create/ |
GET/POST | Create shortened URLs |
/<short_code> |
GET | Redirect to original URL |
/s0/huyvoadmin |
GET | Django admin panel |
FastLink is a production-ready, high-performance URL shortener that demonstrates enterprise-level engineering practices and scalability. Built with modern technologies and battle-tested under extreme load conditions, this system proves that efficient architecture and intelligent caching can deliver exceptional results even on modest hardware.
- 🚀 Exceptional Performance: Sustained 1,200 req/s with P95 latency under 50ms
- 💪 Rock-Solid Stability: Zero errors under 1,000 concurrent users during 60-second stress test
- ⚡ Efficient Resource Usage: 60-70% CPU utilization with 30-40% headroom for traffic spikes
- 🔒 Security First: Cloudflare DDoS protection and Turnstile bot verification
- 📈 Scalable Architecture: Stateless design enables horizontal scaling on demand
- 🎯 Production Proven: Tested on Azure Standard_F8s_v2 infrastructure
Potential improvements for even greater performance:
- Custom domain support for branded short links
- Analytics dashboard for click tracking and metrics
- Rate limiting per user/IP for abuse prevention
- Geographic load balancing for global deployments
- Auto-scaling based on traffic patterns
- Link expiration and scheduling features
⭐ Star this repository if you found it useful!
📧 Questions or feedback? Open an issue or reach out!