A scalable backend service that converts long URLs into short, shareable links. Built using Node.js, Express, PostgreSQL, Redis, and Docker.
This project demonstrates production-style backend architecture including caching, rate limiting, analytics, and containerized deployment.
- Generate short URLs
- Fast redirects
- Redis caching for high performance
- Click analytics tracking
- Rate limiting to prevent abuse
- Dockerized environment
- Clean architecture (Controller / Service / Repository)
User ↓ Express API ↓ Rate Limiter (Redis) ↓ Redis Cache ↓ PostgreSQL Database
- Node.js
- Express.js
- PostgreSQL
- Redis
- Docker
- Docker Compose
src/
config/ controllers/ middlewares/ repositories/ routes/ services/ utils/
server.js
POST /shorten
Request:
{ "url": "https://google.com" }
Response:
{ "shortUrl": "http://localhost:3000/1" }
GET /:shortCode
Example:
GET /1
Redirects to the original URL.
Each redirect updates:
click_count
Stored in PostgreSQL.
docker-compose up --build
Services started:
- Node.js API
- PostgreSQL
- Redis
- Install dependencies
npm install
docker run -d -p 6379:6379 --name redis-server redis
node src/server.js
- Custom short URLs
- Analytics dashboard
- URL expiration
- Distributed ID generator
- Background workers for analytics
Krishna Biradar Backend Developer (Node.js)