A production-grade REST API for creating short links with expiration and view stats. Perfect for invite systems, temporary content access, internal tools, and more.
Includes: SQLite database, expiration logic, Dockerfile, clean modular Flask code.
π Buy it on Gumroad
A robust URL shortening service with built-in expiration, click tracking, and local storage.
- π Expiring short links
- π View tracking per link
- βοΈ SQLite-based storage
- π§° Modular Flask architecture
- π³ Docker support
- π¦ Configurable via .env
- π§Ή Auto-cleanup of expired links
POST
Request Example:
{
"url": "https://example.com",
"expires_in_hours": 24
}Response:
{
"short_url": "http://localhost:5000/s/ABC123",
"expires_at": 1719009999.123
}GET
Redirects to original URL if not expired.
GET
Returns number of views and expiration time.
Response:
{
"views": 3,
"expires_at": 1719009999.123
}{"error": "Missing URL field."}{"error": "URL has expired."}{"error": "URL not found."}pip install -r requirements.txt
- Flask
- python-dotenv
python app.py
Or with Docker:
docker build -t url-shortener-pro .
docker run -p 5000:5000 url-shortener-pro
- β
POST to
/shorten - β
GET
/s/<code>redirect - β
GET
/stats/<code>
See
/screens/for screenshots
Get the ZIP with full project, Docker, and tech support:
π Buy it on Gumroad
- Email: talabov.ali72@gmail.com
- Telegram: @talabovali
π¬ Need this functionality in another language or stack (e.g. Node.js, Go, etc)?
Contact the author: talabov.ali72@gmail.com
π‘ Note: Pricing may vary depending on complexity and target stack.