A small URL shortening service. Paste in a long URL, get back a short one that redirects to the original.
Backend is FastAPI + PostgreSQL, frontend is React. The whole thing runs with Docker Compose.
# inside backend directory
cp .env.example .env# inside root directory
docker compose upThen open http://localhost:8000.
Short codes are 7-character random strings (alphanumeric), generated with Python's secrets module so they aren't guessable.
Routes:
POST /api/url— create a short URLGET /api/url/{code}— look up where a code pointsGET /{code}— redirect (302)
Backend:
cd backend
poetry install
poetry run startFrontend:
cd frontend
npm install
npm run devThe Vite dev server proxies /api to the backend, so you just hit http://localhost:5173.
You'll need a Postgres instance running and a DATABASE_URL set — see .env.example.
cd backend
poetry run pytest