URL Shortener API — Production Engineering Hackathon 2026

Inspiration

I wanted to use this hackathon as an opportunity to learn production engineering fundamentals from the ground up.

What I Built

A REST API for a URL shortening service built with Flask, Peewee ORM, and PostgreSQL. The service allows users to create shortened URLs, track click events, and manage user accounts. It includes:

  • Full CRUD endpoints for users, URLs, and events
  • Automatic short code generation
  • Filtering and pagination on all list endpoints
  • Structured JSON logging on every request
  • A /metrics endpoint exposing live CPU, memory, and disk usage
  • CI/CD pipeline via GitHub Actions that runs tests on every push

How I Built It

I started by analyzing the seed CSV files to understand the data model, then built Peewee models for three tables: users, urls, and events. From there I built Flask blueprints for each resource, added error handling, logging, and tests iteratively.

Challenges

  • Setting up PostgreSQL on a Chromebook running Linux via Crostini required working around ChromeOS constraints instead of using standard tooling
  • The seed data contained duplicate usernames and orphaned foreign keys that required custom deduplication and remapping logic in the data loader
  • Discovering mid-hackathon that the evaluator expected routes and behaviors (auto-generated short codes, PUT/DELETE endpoints, filtering) that weren't in the original template required rapid iteration
  • Running everything, PostgreSQL, Flask, and Locust load tests, simultaneously on a memory-constrained Chromebook (2.7GB RAM)

What I Learned

  • How ORMs like Peewee translate Python objects to SQL and handle foreign key relationships
  • How to structure a Flask API with blueprints for maintainability
  • How CI/CD pipelines work with GitHub Actions and why blocking deploys on failed tests matters
  • How to read load test output and identify bottlenecks — in this case, unparaminated list endpoints returning full datasets were the primary performance constraint

Built With

Share this project:

Updates