Live demo: https://gourl.live
A high-performance URL shortening service written in Go, containerized with Docker, and deployed on AWS infrastructure.
- ⚡️ 1000+ requests/second throughput
- 🔒 TLS/HTTPS secure redirects
- 📦 Docker container support
- ☁️ AWS EC2 deployment ready
- 📈 Built-in health monitoring
- 📝 Custom alias support (optional)
Visit https://gourl.live and enter your URL.
Shorten URL:
curl -X POST https://gourl.live/\
-H "Content-Type: application/json" \
-d '{"url": "https://your-long-url.com"}'
Response:
{
"short_url": "https://gourl.live/abc12",
"original_url": "https://your-long-url.com",
}
Redirect (Use in browsers):
https://gourl.live/abc12
docker run -dp 3000:3000 --name url-shortener yourusername/go-url-shortener
# Clone repository
git clone https://github.com/yourusername/go-url-shortener.git
# Build and run
cd go-url-shortener
go build -o shortener
./shortener
Access at: http://localhost:3000
-
Launch EC2 instance (Ubuntu Linux 2023)
-
Install Docker:
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io -y
sudo systemctl start docker
sudo systemctl enable docker
- Run container:
docker run -dp 80:3000 \
-e PORT=3000 \
-e STORAGE_TYPE=memory \
--restart always \
yourusername/go-url-shortener:latest
- Configure security groups to allow HTTP/HTTPS traffic
Set via environment variables:
Variable | Default | Description |
---|---|---|
PORT |
3000 |
Port the server listens on |
MAX_URL_LENGTH |
2000 |
Maximum allowed URL length |
STORAGE_TYPE |
memory |
Storage backend (memory ) |
CACHE_SIZE |
10000 |
In-memory cache size (if using memory storage) |
- Simple in-memory map
- Data lost on restart
- Great for testing
- Fork the project
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a pull request
Distributed under the MIT License. See LICENSE
for more information.
Happy shortening! ✂️🚀