LinkSage — Link Tracking & Analytics API
LinkSage is a backend micro-SaaS built in Python that provides URL shortening, click tracking, and analytics reporting via a clean REST API. It records metadata on every click — including timestamp, referrer, and user agent — and exposes an analytics endpoint so users can see how their links are performing in real time. Built with clean API design principles and containerized for easy deployment.
Tech Stack
The Challenge
Needed a lightweight, self-hostable alternative to third-party link shorteners that gave full ownership of analytics data without relying on external services or paying for a SaaS plan.
Architecture
FastAPI handles routing and request validation. PostgreSQL stores link records and click events. Each shortened URL is assigned a unique slug; on redirect, a click event is logged asynchronously before the user is forwarded. The analytics endpoint aggregates click data per link with filtering by date range.
Deployment Strategy
Containerized with Docker and Docker Compose for local development and production parity. GitHub Actions runs linting and tests on every push. Deployment targets a cloud VPS with an Nginx reverse proxy handling SSL termination and routing to the FastAPI container.
Outcome
Clean, documented REST API with full click tracking per shortened link. Self-hosted with zero dependency on third-party analytics. Easy to extend with new metrics or export formats.