Skip to content

Repository files navigation

Link Cutter

CI Coverage Python

Link Cutter is a lightweight, extensible URL shortener with basic analytics.

Built with FastAPI; links are stored in PostgreSQL. Intended as an MVP or a foundation for further development (custom domains, paid plans, webhooks, QR codes).

Features

  • Create short links (auto Base62 codes and custom codes)
  • Redirect with 301
  • Collect basic analytics: clicks, device/platform/browser (User-Agent parsing), referrer, geo (by IP)
  • User and API key support
  • Security: target URL validation (blocks local/dangerous addresses)

Stack

  • Python 3.12
  • FastAPI (ASGI)
  • PostgreSQL (SQLAlchemy / Alembic)
  • Pydantic
  • Uvicorn (ASGI server)
  • Loguru (logging)
  • Docker / docker-compose

Start with docker

  1. Copy example.env.env and fill secrets.
  2. Generate JWT keys (once):
mkdir -p certs
openssl genrsa -out certs/jwt-private.pem 2048
openssl rsa -in certs/jwt-private.pem -pubout -out certs/jwt-public.pem
  1. Build and run:
docker compose up --build -d

API: http://localhost:${API_PORT} (default 9000), health: /health.

About

Link Cutter - A lightweight and scalable service for creating short links with basic analytics.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages