-
URL Shortener API v1.0.0 Stable
released this
2026-03-05 20:07:25 +00:00 | 1 commits to main since this releaseProduction-ready URL Shortener built with FastAPI, PostgreSQL, Docker, and Alembic.
Techstack
FastAPI, PostgreSQL, SQLAlchemy 2.0, Alembic, Docker, Pytest and Pydantic v2
Features
Shorten URLs, Redirect, Click tracking, Stats endpoint, Collision handling, 99%+ test coverage, Dockerized and Alembic migrations
Local Setup
cd <your-repo-url> python3 -m venv venv source venv/bin/activateCreate .env, copy as this as template:
.env.exampleRun:
python -m uvicorn app.main:app --reload --host 0.0.0.0 --port 9995Then check:
http://localhost:9995
http://localhost:9995/docsTest Short URL Endpoint:
http://localhost:9995/shortenRunning Alembic revision
cd <your-repo-url> alembic revision --autogenerate -m "create urls table"Running project in Docker container
cd <your-repo-url> docker compose up --buildRunning tests in Docker container
cd <your-repo-url> docker compose up --build docker compose exec app pytest --cov=app --cov-report=term-missingDownloads