Skip to content

Repository files navigation

Professional-URL-Shortener-Python

A professional command-line URL Shortener built with Python featuring URL validation, custom short codes, duplicate detection, JSON storage, statistics, and modular architecture.

🔗 Professional URL Shortener

A professional command-line URL Shortener built with Python. This application allows users to shorten long URLs, generate unique short codes, retrieve original URLs, manage stored links, and maintain persistent data using a JSON database.


📌 Features

  • ✅ Shorten long URLs
  • ✅ Generate unique random short codes
  • ✅ Create custom short codes
  • ✅ URL validation
  • ✅ Automatic https:// support
  • ✅ Duplicate URL detection
  • ✅ Retrieve original URL
  • ✅ View all stored URLs
  • ✅ Delete URLs
  • ✅ Statistics Dashboard
  • ✅ JSON-based database
  • ✅ Modular project structure
  • ✅ Exception handling
  • ✅ Beginner-friendly and scalable architecture

📂 Project Structure

Professional-URL-Shortener/
│
├── main.py
├── url_manager.py
├── file_handler.py
├── validator.py
├── utils.py
├── config.py
├── urls.json
├── requirements.txt
├── .gitignore
├── LICENSE
└── README.md

🚀 Installation

1️⃣ Clone Repository

git clone https://github.com/humma2730-collab/Professional-URL-Shortener-Python.git

2️⃣ Open Project

cd Professional-URL-Shortener-Python

3️⃣ Install Dependencies

pip install -r requirements.txt

4️⃣ Run Project

python main.py

🖥️ Main Menu

==================================================
         PROFESSIONAL URL SHORTENER
==================================================

1. Shorten New URL
2. Open Original URL
3. View All URLs
4. Delete URL
5. Statistics
6. Exit

📸 Sample Output

Create Short URL

Enter Long URL:
https://github.com

Custom short code (Press Enter to skip):

[SUCCESS] Short URL Created Successfully!

Original URL : https://github.com

Short URL    : http://short.ly/aB7X2K

View All URLs

============================================================

1.

Short Code : aB7X2K

Short URL  : http://short.ly/aB7X2K

Original   : https://github.com

Created At : 2026-07-30 18:30:45

============================================================

Statistics

========== STATISTICS ==========

Total URLs : 12

Oldest Code : aB7X2K

Newest Code : xY91Lm

===============================

💾 JSON Database

{
    "aB7X2K": {
        "url": "https://github.com",
        "created_at": "2026-07-30 18:30:45"
    }
}

🛠 Technologies Used

  • Python 3
  • JSON
  • Validators Library
  • File Handling
  • Modular Programming

📦 Requirements

validators==0.35.0

Install using:

pip install -r requirements.txt

🎯 Python Concepts Used

  • Functions
  • Modules
  • Dictionaries
  • Nested Dictionaries
  • JSON
  • File Handling
  • Exception Handling
  • Random Code Generation
  • Date & Time
  • Loops
  • Conditional Statements
  • Input Validation

🔮 Future Improvements

  • 🌐 Flask Web Version
  • 🗄 SQLite Database Support
  • 📊 URL Analytics
  • 📈 Click Counter
  • 🔐 Password-Protected URLs
  • ⏳ Link Expiration
  • 📱 REST API
  • 📱 QR Code Generator
  • ☁ MongoDB Integration
  • 👤 User Authentication

👨‍💻 Author

Huma Fatima

BS Computer Science Student

GitHub: https://github.com/humma2730-collab


🤝 Contributing

Contributions, suggestions, and improvements are welcome.

  1. Fork the repository
  2. Create a new branch
  3. Commit your changes
  4. Push your branch
  5. Create a Pull Request

📄 License

This project is licensed under the MIT License.


⭐ Support

If you found this project useful, don't forget to Star ⭐ the repository.

Happy Coding! 🚀

About

A professional command-line URL Shortener built with Python featuring URL validation, custom short codes, duplicate detection, JSON storage, statistics, and modular architecture.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages