A distributed URL shortening service built with Go, featuring high availability, scalability, and reliable shortcode generation.
- Distributed URL shortening across multiple instances
- Base62 encoding for readable short URLs
- Distributed range allocation for unique IDs
- Redis caching for fast URL retrieval
- MongoDB for persistent URL storage
- Traefik for load balancing and routing
- Docker containerization and orchestration
- Health monitoring and automatic container updates
- gRPC communication between services
- Frontend: GoTiny App - Built with Remix Run and ShadCN/UI
- Backend: This repository - Go service for URL shortening
- Range Allocator: Range Allocator Service - Manages ID ranges
graph TD
A[Frontend - Remix] --> B[Traefik Load Balancer]
B --> C[GoTiny Service]
C --> D[Redis Cache]
C --> E[MongoDB]
C --> F[Range Allocator]
F --> G[PostgreSQL]
- Clone the repository:
git clone https://github.com/RajNykDhulapkar/gotiny.git
cd gotiny
- Setup local environment:
./scripts/setup.sh
- Start services:
docker-compose up -d
Environment variables:
GOTINY_PORT=8080
REDIS_URL=redis:6379
RANGE_ALLOCATOR_ADDRESS=range-allocator:50051
SERVICE_ID=url-shortener
MONGODB_URI=mongodb://mongodb:27017
MONGODB_DATABASE=urlshortener
POST /create-short-url
- Create short URLGET /:shortUrl
- Redirect to original URLGET /urls/:userId
- Get user's URLsGET /health
- Service health check
# Install dependencies
make deps
# Run locally
make run
# Build
make build
# Run tests
make test
MIT License