A minimalist, fast, and fault-tolerant URL shortener built with Go and Redis. Features click tracking, anonymous user history, and built-in rate limiting for DDoS protection.
- 🌐 Live Website: https://shorturl-ftoa.onrender.com
DEMO.mp4
- Clone the repository:
git clone [https://github.com/synnfluxx/shortURL.git](https://github.com/synnfluxx/shortURL.git)
cd shortURL- Start the services:
docker-compose up -d --build- Access the web interface at
http://localhost:8080
Prerequisites: Installed Go 1.25+ and a running Redis instance (on localhost:6379).
- Copy the environment file template:
cp .env.example .env
-
Configure your variables in
.env: -
Run the application:
go run cmd/main.go -c config/local.yaml
- POST
/short - Content-Type:
application/x-www-form-urlencoded - Body:
link=https://example.com/very/long/url - Response (200 OK):
{
"short": "x8Y",
"link": "[https://example.com/very/long/url](https://example.com/very/long/url)"
}
- GET
/history - Cookie:
user_tracker_id=...(automatically set) - Response (200 OK):
[
{
"short_id": "x8Y",
"original_link": "[https://example.com/very/long/url](https://example.com/very/long/url)",
"total_clicks": 12
}
]
- GET
/{id} - Response:
302 Found(Increments click counter and redirects to destination).
This project is licensed under the MIT License. See the LICENSE file for details.