Skip to content

PrashantMhrzn/Little-Link

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Little Link - URL Shortener

A Django-based URL shortener web application that allows users to create, manage, and track shortened URLs.

Live Demo: https://prashantmaharjan.pythonanywhere.com

Usage

Once you register and login, create a short URL and then you can access it using this format:

https://prashantmaharjan.pythonanywhere.com/your-short-code

Examples:

  • Custom URL: https://prashantmaharjan.pythonanywhere.com/my-task
  • Auto-generated: https://prashantmaharjan.pythonanywhere.com/aB3x9K
  • Any short code: https://prashantmaharjan.pythonanywhere.com/your-custom-slug

The short URL will automatically redirect to your original long URL.

Features

Core Features

  • User Authentication: Secure user registration, login, and logout system
  • URL Shortening: Convert long URLs to short 6-character codes
  • Custom Short URLs: Option to create custom aliases for shortened URLs
  • URL Management: View, edit, and delete created short URLs
  • Click Analytics: Track and display click counts for each shortened URL
  • Redirect System: Automatic redirection from short URLs to original destinations

URL Management

  • Dashboard: Overview of all created URLs with statistics
  • Edit URLs: Modify destination URLs while preserving short codes
  • Delete URLs: Remove unwanted short URLs with confirmation
  • Recent Links: Quick access to recently created short URLs

Security Features

  • User authentication required for URL management
  • Users can only access and modify their own URLs
  • Secure password handling with Django's authentication system
  • Input validation for URLs and custom slugs

Additional Features Implemented

Custom URL Shortening

  • Users can create memorable custom short codes instead of random strings
  • Custom slug validation to ensure availability and proper formatting
  • Automatic fallback to random generation if no custom slug provided

User Experience

  • Responsive Bootstrap-based UI works on all devices
  • Success and error message notifications
  • Clean, intuitive interface for URL management
  • Redirect page with automatic and manual navigation options

Installation

Prerequisites

  • Python 3.8+
  • Django 5.2+
  • PostgreSQL (recommended) or SQLite

Setup Instructions

  1. Clone the repository

    git clone https://github.com/PrashantMhrzn/Little-Link.git
    cd Little-Link
  2. Create virtual environment

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

    pip install -r requirements.txt
  4. Configure database

    python manage.py migrate
  5. Create superuser

    python manage.py createsuperuser
  6. Run development server

    python manage.py runserver

Usage

  1. Registration: Create a new account through the registration page
  2. Login: Access your dashboard with your credentials
  3. Create Short URL:
    • Enter the destination URL
    • Optionally provide a custom slug
    • Generate the short URL
  4. Manage URLs: View, edit, or delete your shortened URLs from the dashboard
  5. Track Analytics: Monitor click counts for each shortened URL

API Endpoints

  • / - Home page
  • /dashboard/ - User dashboard
  • /login/ - User login
  • /register/ - User registration
  • /logout/ - User logout
  • /create_short_url/ - Create new short URL
  • /edit/<url_id>/ - Edit existing URL
  • /delete/<url_id>/ - Delete URL
  • /<short_url>/ - Redirect to original URL

Technology Stack

  • Backend: Django 5.2, Python 3.13
  • Frontend: HTML5, Bootstrap 5, Django Templates
  • Database: SQLite
  • Authentication: Django built-in authentication system

Custom Short Code Generation

The application uses a custom key generation system that:

  • Generates 6-character codes using random selection
  • Ensures uniqueness by checking against existing codes in the database
  • Provides fallback mechanism for collisions

About

A Django-based URL shortener web application that allows users to create, manage, and track shortened URLs.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published