Back to Projects
Backend & Systems
Completed

URL Shortener

A high-performance URL shortening service built with Go.

February 2026Team: Personal ProjectRole: Go Developer
URL Shortener

About this Project

URL Shortener is a lightweight, fast, and efficient service for converting long URLs into short, shareable links. Built entirely in Go, it demonstrates clean API design, efficient data handling, and practical backend development patterns — perfect for learning URL compression algorithms and building scalable web services.

Tech Stack

Go
REST APIs
Hash Generation
Redirects

Tools Used

VS Code
Git
Go Modules

Key Features

Core Features

  • URL Shortening: Convert long URLs into short, unique identifiers with just an API call.
  • Fast Redirects: Efficient redirect service that handles high-volume traffic.
  • Collision Prevention: Smart hashing algorithm ensures no duplicate short URLs.
  • RESTful API: Simple, clean endpoints for creating and retrieving short URLs.

Technical Implementation

  • Hash-Based Generation: Efficient algorithm for generating short URL identifiers.
  • Data Storage: Persistent mapping between short and long URLs.
  • Optimal Performance: Built for speed with minimal overhead.
  • Production-Ready: Error handling and request validation throughout.

Learning Outcomes

  • URL Encoding: Understanding URL structures and encoding schemes.
  • Hashing Algorithms: Implementing collision-free hash functions.
  • API Design: Building simple yet powerful RESTful endpoints.
  • Backend Patterns: Real-world backend development best practices.

Highlights

URL Compression
Fast Redirects
Collision-Free Hashing
Clean API

Installation

Clone the Repository

git clone https://github.com/Itsayu/url-shortner.git
cd url-shortner

Install Dependencies

go mod download
go mod tidy

Run the Service

go run main.go
# Service starts on localhost:8080

Create a Short URL

curl -X POST http://localhost:8080/api/shorten \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/very/long/url"}'

# Response: {"short_url": "http://localhost:8080/abc123"}

Challenges & Solutions

Challenge

Generating unique short identifiers without collisions

Solution

Implemented a base62 encoding system combined with sequential IDs or custom hashing to ensure every long URL gets a unique short code.

Challenge

Handling high-volume redirect requests efficiently

Solution

Used fast in-memory lookups and optimized database queries to serve redirects in milliseconds without bottlenecks.

Challenge

Keeping the implementation minimal yet complete

Solution

Focused on core functionality with clean Go code — no unnecessary frameworks or dependencies, just pure backend logic.

Challenge

URL validation and error handling

Solution

Added comprehensive validation for incoming URLs and proper HTTP error responses for edge cases.

LinkedIn
GitHub