🔗 snip. — A Reliable URL Shortening Service

Track: Reliability Engineering

🎯 Inspiration

Every developer has dealt with long, unwieldy URLs that are hard to share. But building a URL shortener isn't just about shortening links — it's about building something that doesn't break. We wanted to create a service that could serve as a real-world example of production-grade reliability engineering: a system with automated testing, continuous integration, and graceful failure handling baked in from day one.

🧩 The Problem

Most demo projects work fine in ideal conditions, but fall apart the moment something unexpected happens. Bad input causes crashes. No tests means no confidence. No CI means broken code ships. We asked ourselves: can we build something simple enough to demo in under a minute, but engineered well enough to survive in production?

💡 What It Does

snip.URL Shortener is a URL shortening service with a clean web interface where users can: URL Shortening — Paste any long URL and instantly receive a short link. Custom Codes — Optionally specify a custom short code (e.g. /my-link). Redirects — Click any short link to instantly redirect to the original URL. Click Tracking — Every redirect is recorded, giving each link a live click count. Soft Deletion — Links can be deactivated without losing historical data. Health Endpoint — A /health endpoint reports service and database status in real time.

🔧 How We Built It

Frontend: Vanilla HTML, CSS, JavaScript — clean dark UI served directly by Flask. Backend:

Framework: Flask (Python) ORM: Peewee Database: PostgreSQL Package Manager: uv

Testing:

pytest with pytest-cov 49 automated tests 82% code coverage (Gold tier requires 70%) SQLite in-memory database for fast, isolated test runs

CI/CD: GitHub Actions — runs the full test suite on every commit. Deployment is blocked if any test fails. Infrastructure: Docker + Docker Compose with restart: always for automatic container recovery.

🪨 Challenges We Ran Into

Test Isolation — Getting Peewee's DatabaseProxy to swap between PostgreSQL (production) and SQLite (testing) without touching model code required careful architecture. Graceful Error Handling — Ensuring every possible failure — bad input, unknown routes, database errors — returns clean JSON instead of a Python stack trace took systematic error handler design. Coverage Without Overhead — Hitting 82% coverage while keeping tests fast (0.33 seconds) required writing focused unit and integration tests rather than end-to-end tests.

🏆 Accomplishments We're Proud Of

Built a fully functional, production-grade service as a two-person team in a single hackathon session. This is also both of our first hackathons ever. Achieved 82% test coverage, exceeding the Gold tier requirement of 70%. Designed a dual-database architecture (PostgreSQL in production, SQLite in testing) that requires zero configuration changes between environments. Implemented graceful failure across every endpoint. The service never crashes on bad input.

🔭 What's Next for snip.

QR Code Generation — Auto-generate a scannable QR code for every short link. Link Expiration — Allow users to set an expiry date on short links. Analytics Dashboard — Visualize click counts over time with charts. Rate Limiting — Prevent abuse by limiting how many links a single IP can create per hour. Public API — Expose a documented REST API so developers can integrate snip. into their own tools.

Built With

Share this project:

Updates