Skip to content
synnfluxxPublic

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

⚡ ShortURL — High-Performance URL Shortener Service

Go Version Redis Docker License

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.


🔗 Demo & Links

DEMO.mp4

🚀 Quick Start

Option 1: Running with Docker Compose (Recommended)

  1. Clone the repository:
git clone [https://github.com/synnfluxx/shortURL.git](https://github.com/synnfluxx/shortURL.git)
cd shortURL
  1. Start the services:
docker-compose up -d --build
  1. Access the web interface at http://localhost:8080

Option 2: Local Setup (Without Docker)

Prerequisites: Installed Go 1.25+ and a running Redis instance (on localhost:6379).

  1. Copy the environment file template:
cp .env.example .env
  1. Configure your variables in .env:

  2. Run the application:

go run cmd/main.go -c config/local.yaml

📡 API Reference

1. Shorten URL

  • 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)"
}

2. Get User History

  • 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
  }
]

3. Redirect to Original URL

  • GET /{id}
  • Response: 302 Found (Increments click counter and redirects to destination).

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.

Releases

Packages

Contributors

Languages