UNORDERED LIST
==============
Minimal URL shortener.
Shortening URLs
Send HTTP POST requests to https://ul.jamell.dev/s with JSON body:
curl -X POST https://ul.jamell.dev/s \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com"}'
Or use a simple GET request with query parameter:
curl "https://ul.jamell.dev/s?u=https://example.com"
Response:
┌─────────────┬────────────────────────────────────────────────────┐
│ field │ description │
╞═════════════╪════════════════════════════════════════════════════╡
│ short_code │ The unique identifier for the shortened URL │
├─────────────┼────────────────────────────────────────────────────┤
│ short_url │ Full shortened URL │
├─────────────┼────────────────────────────────────────────────────┤
│ original_url│ The URL you submitted │
├─────────────┼────────────────────────────────────────────────────┤
│ created_at │ Timestamp of URL creation │
└─────────────┴────────────────────────────────────────────────────┘
The same URL will always generate the same short code.
Using shortened URLs
Access your shortened URL:
https://ul.jamell.dev/{short_code}
This will redirect you to the original URL and track the click.
Viewing statistics
Get statistics for any shortened URL:
curl "https://ul.jamell.dev/{short_code}/stats"
Response includes:
- Total clicks
- Creation timestamp
- Last clicked timestamp
- Original URL
QR codes
Generate a QR code for any shortened URL:
https://ul.jamell.dev/{short_code}/qr
Returns a PNG image that can be scanned to access the shortened URL.
Features
[x] Collision-free short codes using ID obfuscation
[x] URL validation (http/https only)
[x] Click tracking with User-Agent and Referer
[x] QR code generation
[x] Statistics endpoint
[x] Idempotent: same URL -> same short code
[x] libsql/SQLite backend
[x] No tracking, no ads, no bullshit
API Reference
Endpoints:
┌────────────────────────────────┬──────────────────────────────┐
│ endpoint │ description │
╞════════════════════════════════╪══════════════════════════════╡
│ POST /s │ Shorten URL (JSON body) │
├────────────────────────────────┼──────────────────────────────┤
│ GET /s?u={url} │ Shorten URL (query param) │
├────────────────────────────────┼──────────────────────────────┤
│ GET /{short_code} │ Redirect to original URL │
├────────────────────────────────┼──────────────────────────────┤
│ GET /{short_code}/stats │ Get statistics │
├────────────────────────────────┼──────────────────────────────┤
│ GET /{short_code}/qr │ Get QR code (PNG) │
├────────────────────────────────┼──────────────────────────────┤
│ GET /health │ Health check │
└────────────────────────────────┴──────────────────────────────┘
Source: github.com/Sardonyx001/ul