A modern, feature-rich URL shortening service built with Flask and modern web technologies. Transform long URLs into memorable short links with comprehensive analytics.
Features • Demo • Installation • API • Contributing
🔹 Instant Shortening: Convert long URLs into concise, shareable links
🔹 Custom Aliases: Create branded short URLs for better recognition
🔹 Expiration Control: Set expiry dates for temporary links
🔹 Rich Analytics: Track clicks, locations, devices, and more
🔹 Visual Insights: Interactive charts powered by Chart.js
🔹 Real-time Updates: Monitor URL performance in real-time
🔹 Responsive Design: Perfect experience across all devices
Experience the application in action: Live Demo
- Python: Core programming language
- Flask: Web framework
- SQLAlchemy: ORM for database operations
- Bootstrap 5: Responsive UI framework
- Chart.js: Interactive data visualization
- Font Awesome: Beautiful icons
- SQLite: Lightweight database
- user-agents: Device detection
-
Clone the repository
git clone https://github.com/hassanrrraza/url_shortener.git cd url_shortener -
Set up virtual environment
# Windows python -m venv venv venv\Scripts\activate # macOS/Linux python -m venv venv source venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Initialize database
python init_db.py
-
Start the server
python run.py
-
Visit
http://localhost:5000in your browser
POST /api/shorten| Parameter | Type | Description |
|---|---|---|
url |
string |
Required. URL to shorten |
custom_alias |
string |
Custom alias for the URL |
expiry_date |
string |
Expiration date (ISO format) |
GET /api/analytics/:idDELETE /api/urls/:idurl_shortener/
├── app/ # Application package
│ ├── models.py # Database models
│ ├── routes.py # API endpoints
│ ├── static/ # Static assets
│ └── templates/ # HTML templates
├── instance/ # Instance data
├── requirements.txt # Dependencies
└── run.py # Entry point
Contributions are what make the open source community amazing! Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- User authentication system
- QR code generation
- Password-protected links
- Bulk URL shortening
- Advanced analytics export
- API rate limiting
- Custom domain support
Distributed under the MIT License. See LICENSE for more information.
Hassan Raza - @hassanrrraza
Project Link: https://github.com/hassanrrraza/url_shortener