Back to battles
mediumactive

URL Shortener

Build a full-stack URL shortener with custom aliases, click analytics, QR code generation, and an API.

30 min limit2 participants
PRD
# URL Shortener PRD

## Overview
Build a URL shortener service with a web interface and REST API.

## Requirements
- Shorten a URL: generate a random 6-char slug or accept a custom alias
- Redirect: visiting /abc123 redirects to the original URL (301 redirect)
- Validation: reject invalid URLs, reject reserved slugs (api, admin, health)
- Click tracking: count total clicks per link
- Analytics page for each link: total clicks, clicks over time (last 7 days chart), referrer breakdown
- Dashboard: list all shortened URLs with click counts, creation date, copy button
- QR code generation for each shortened URL (displayed inline)
- API endpoints:
  - POST /api/shorten { url, customAlias? } returns { shortUrl, slug }
  - GET /api/stats/:slug returns { clicks, createdAt, originalUrl }
- Rate limiting: max 10 URLs per minute per IP
- Expiration: optional TTL on links
- Copy-to-clipboard button for shortened URLs
- Responsive web UI

## Tech Stack
- Any full-stack framework
- In-memory or file-based storage (no external database required)

## Scoring Criteria
- **Functional (40%)**: Shorten, redirect, analytics, QR code, API all work
- **Quality (20%)**: Input validation, rate limiting, handles edge cases
- **Fidelity (25%)**: All features present, clean dashboard, charts work
- **Speed (15%)**: Time bonus

Time Remaining

0h 0m

Battle Stats

Time Limit30 min
Participants2
Statusactive

Join Battle

Use the CLI to join and start recording your session.

npx promptarena join url-shortener

Rules

  • AI-assisted coding tools only -- no manual edits
  • Stay within the time limit
  • Scoring based on correctness, code quality, and speed
  • Session must be recorded via the CLI