Skip to content

Repository files navigation

SnipURL - URL Shortener

A robust URL shortening service built with FastAPI and PostgreSQL, featuring rate limiting and efficient URL management.

Features

  • URL Shortening: Convert long URLs into short, unique codes.
  • Redirection: Seamlessly redirect short URLs to their original destinations.
  • Rate Limiting: Protect the service from abuse with IP-based rate limiting.
  • Database: Persistent storage using PostgreSQL via SQLAlchemy 2.0.

Prerequisites

  • Node.js (v16 or higher)
  • NPM (v8 or higher)
  • Python (v3.9+)
  • PostgreSQL (running locally or remotely)

Setup

1. Backend Setup

  1. Navigate to the backend directory:

    cd URLShortner
  2. Install Python dependencies:

    pip install -r requirements.txt
  3. Set up the database:

    • Ensure PostgreSQL is running.
    • Create a database (e.g., urlshortener).
    • Run the initialization script:
      python init_db.py
  4. Run the development server:

    python main.py

    The API will be available at http://localhost:8000.

2. Frontend Setup

  1. Navigate to the frontend directory:

    cd snipurl-main
  2. Install Node.js dependencies:

    npm install
  3. Start the development server:

    npm run start

    The application will be available at http://localhost:3000.

Usage

Creating a Short URL

Use the "Create Short URL" form on the homepage:

  1. Enter the long URL you want to shorten.
  2. Click "Create".
  3. The shortened URL will appear below.

Redirection

Simply paste the short URL into your browser's address bar. You will be automatically redirected to the original long URL.

Technologies Used

Backend

  • Framework: FastAPI
  • ORM: SQLAlchemy 2.0
  • Database: PostgreSQL
  • Runtime: Uvicorn ASGI server
  • Validation: Pydantic

Frontend

  • Framework: React
  • Language: JavaScript (ES6+)
  • Styling: Custom CSS
  • Build Tool: Vite

About

SnipURL is a fast and scalable URL shortening platform built with FastAPI, PostgreSQL, React, and Vite. It allows users to generate short links, manage redirects efficiently, and ensures reliability with IP-based rate limiting, modern API architecture, and responsive frontend design.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages