Engineering Deep Dive · Engineering · Infrastructure

Snip: A production-shaped URL shortener

FastAPI + SQLite short links with aliases, redirects, expiry, visit stats, and a TypeScript operator UI.

Open Source

Challenge → Tradeoffs → Architecture → Implementation → Validation

IntrofinityView source

Small products still need sharp edges

URL shorteners are a solved category until you implement one carefully. Then the boring requirements show up: stable aliases, safe redirects, optional expiry, visit counting, health checks, and an API that is boring enough to trust.

Snip is Introfinity’s production-shaped take on that problem. The stack is FastAPI and SQLite on the backend, with a TypeScript frontend for create, result, and stats flows. The point is not novelty. The point is a complete loop you can run, test, and extend.

API surface

The service exposes a small, explicit contract:

  • POST /api/links — create a short link with URL, optional alias, optional expiry
  • GET /{alias} — redirect to the original URL
  • GET /api/links/{alias} — link stats including visit count
  • GET /health — health check

Create responses return alias, short URL, original URL, timestamps, expiry, and visit count. That payload is enough for a UI and enough for clients that never open a browser.

Why SQLite was the right first store

For a single-node shortener, SQLite keeps the operational story honest. There is one database file, clear local development, and no pretend distributed complexity. The schema only has to answer a few questions well: does this alias exist, where does it go, has it expired, and how many times was it followed?

Production habits still apply. The project uses a virtualenv-friendly install path, pytest coverage, and a configurable DATABASE_PATH so deployment is not hard-coded to a developer laptop.

Frontend as a thin operator console

The TypeScript frontend is organized around three jobs: shorten a URL, show the resulting short link, and look up stats. That is the entire operator surface. Keeping the UI that narrow prevents the product from turning into an analytics suite before the redirect path is trustworthy.

What this case study claims

Infrastructure taste shows up in small systems. Snip is a reminder that Introfinity ships complete, testable services — even when the domain is familiar — because reliable redirects and measurable traffic are still product requirements.

Source: github.com/syedsadiq27/snip

← All work