Skip to content

hassanrrraza/url_shortener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔗 URL Shortener

Python Flask License PRs Welcome

A modern, feature-rich URL shortening service built with Flask and modern web technologies. Transform long URLs into memorable short links with comprehensive analytics.

FeaturesDemoInstallationAPIContributing

URL Shortener Dashboard

✨ Features

🔹 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

🚀 Live Demo

Experience the application in action: Live Demo

🛠️ Tech Stack

Backend

Frontend

Database & Tools

  • SQLite: Lightweight database
  • user-agents: Device detection

📦 Installation

  1. Clone the repository

    git clone https://github.com/hassanrrraza/url_shortener.git
    cd url_shortener
  2. Set up virtual environment

    # Windows
    python -m venv venv
    venv\Scripts\activate
    
    # macOS/Linux
    python -m venv venv
    source venv/bin/activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Initialize database

    python init_db.py
  5. Start the server

    python run.py
  6. Visit http://localhost:5000 in your browser

📝 API Reference

Create Short URL

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 URL Analytics

GET /api/analytics/:id

Delete URL

DELETE /api/urls/:id

📂 Project Structure

url_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

🤝 Contributing

Contributions are what make the open source community amazing! Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

🔮 Future Enhancements

  • User authentication system
  • QR code generation
  • Password-protected links
  • Bulk URL shortening
  • Advanced analytics export
  • API rate limiting
  • Custom domain support

📄 License

Distributed under the MIT License. See LICENSE for more information.

👏 Acknowledgements

📬 Contact

Hassan Raza - @hassanrrraza

Project Link: https://github.com/hassanrrraza/url_shortener


⭐ Star this repo if you find it helpful!

About

A modern URL shortening service with a sleek dashboard and powerful analytics, built with Python, Flask, and modern frontend technologies.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors