Skip to content

Latest commit

 

History

41 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A fast and lightweight full-stack URL shortener built with FastAPI, SQLite, and React. It converts long URLs into unique 6-character short links and tracks redirect statistics in real time.


✨ Features

  • ✂️ Shorten URLs — Generate unique, collision-resistant 6-character short codes.
  • 🔀 Fast Redirects — Redirect users instantly using HTTP 307 responses.
  • 📊 Click Analytics — Track the number of visits for every shortened URL.

🛠️ Tech Stack

Backend

  • Python 3.12+
  • FastAPI
  • SQLAlchemy
  • Pydantic v2

Frontend

  • React
  • CSS3

Database

  • SQLite

DevOps

  • Docker
  • Multi-stage Docker Build

🚀 Getting Started

🐳 Run with Docker (Recommended)

Build the Docker image:

docker build -f server/Dockerfile -t url-shortener .

Run the container:

docker run -d \
  -p 8000:8000 \
  -v $(pwd)/server/shortener.db:/app/server/shortener.db \
  --name url-shortener-app \
  url-shortener

Stop the container:

docker stop url-shortener-app

Remove the container:

docker rm url-shortener-app

Once the container is running:

Service URL
🌐 Application http://localhost:8000
📚 Swagger UI http://localhost:8000/docs
📄 ReDoc http://localhost:8000/redoc

💻 Local Development

Navigate to the backend:

cd server

Create a virtual environment:

python -m venv .venv

Activate it.

Linux / macOS

source .venv/bin/activate

Windows (PowerShell)

.venv\Scripts\Activate.ps1

Install dependencies:

pip install -r requirements.txt

Start the development server:

python app/main.py

📌 Roadmap

  • URL shortening endpoint
  • Redirect endpoint
  • Click analytics
  • React dashboard
  • Search and filter links
  • Copy-to-clipboard button

📄 License

This project is licensed under the MIT License.

Releases

Packages

Contributors

Languages