Skip to content

smartgic/shortgic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

37 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ ShortGic - Lightning Fast URL Shortener

License: Apache 2.0 contributions welcome Discord

Transform long URLs into short, shareable links in milliseconds ⚑

ShortGic is a blazingly fast, enterprise-ready URL shortener built with modern Python. Perfect for developers, businesses, and anyone who needs reliable link management.

✨ Why Choose ShortGic?

  • πŸ”₯ Ultra Fast - Built with FastAPI for maximum performance
  • πŸ›‘οΈ Enterprise Security - Cryptographically secure link generation
  • 🎯 Zero Dependencies - SQLite database, no external services needed
  • πŸ”§ Developer Friendly - RESTful API with automatic documentation
  • πŸ“¦ Docker Ready - Deploy anywhere in seconds
  • 🎨 Customizable - Environment-based configuration
  • πŸ“Š Production Ready - Comprehensive error handling and validation

πŸš€ Quick Start

Option 1: Docker (Recommended)

# Run instantly with Docker
docker run -d --name shortgic -p 8000:8000 smartgic/shortgic:latest

# Your URL shortener is now live at http://localhost:8000

Option 2: Local Installation

# Clone and setup
git clone https://github.com/smartgic/shortgic.git
cd shortgic
pip install -r requirements.txt

# Launch in seconds
uvicorn app.main:app --host 0.0.0.0 --port 8000

That's it! πŸŽ‰ Your URL shortener is running at http://localhost:8000

πŸ’‘ Usage Examples

Create Short Links

# Basic URL shortening
curl -X POST http://localhost:8000 \
  -H "Content-Type: application/json" \
  -d '{"target": "https://your-very-long-url.com/with/many/parameters"}'

# Response: {"link": "ABC12"}

Add Metadata (Perfect for Analytics)

# Track campaigns, versions, or any custom data
curl -X POST http://localhost:8000 \
  -H "Content-Type: application/json" \
  -d '{
    "target": "https://smartgic.io",
    "extras": {
      "campaign": "summer-2024",
      "source": "email",
      "validated": true
    }
  }'

Access Your Links

# Redirect to original URL
curl -L http://localhost:8000/ABC12

# Get link information and metadata
curl http://localhost:8000/ABC12/info

Manage Links

# Delete a link permanently
curl -X DELETE http://localhost:8000/ABC12

🎯 Perfect For

  • Developers - Clean API for integration into any application
  • Marketers - Track campaigns with custom metadata
  • Businesses - Self-hosted solution with full control
  • Content Creators - Shorten links for social media
  • Teams - Internal link management and sharing

πŸ”§ Advanced Configuration

Customize ShortGic with environment variables:

# Database location
export SHORTGIC_DATABASE_PATH="./my-links.db"

# Link length (default: 5 characters)
export SHORTGIC_LINK_LENGTH=8

# Maximum URL length (default: 2048)
export SHORTGIC_MAX_URL_LENGTH=4096

# Debug mode
export SHORTGIC_DEBUG=true

πŸ“š API Documentation

ShortGic automatically generates beautiful, interactive API documentation:

  • Swagger UI: http://localhost:8000/docs
  • ReDoc: http://localhost:8000/redoc

πŸ—οΈ Production Deployment

Docker Compose

version: "3.8"
services:
  shortgic:
    image: smartgic/shortgic:latest
    ports:
      - "8000:8000"
    environment:
      - SHORTGIC_DATABASE_PATH=/data/shortgic.db
    volumes:
      - ./data:/data
    restart: unless-stopped

Environment Variables

# Production settings
SHORTGIC_DATABASE_PATH=/var/lib/shortgic/shortgic.db
SHORTGIC_DEBUG=false
SHORTGIC_LINK_LENGTH=6

πŸ›‘οΈ Security Features

  • Cryptographically Secure - Uses Python's secrets module for link generation
  • Input Validation - Comprehensive URL and format validation
  • Error Handling - Detailed error responses without information leakage
  • No External Dependencies - Reduces attack surface

πŸš€ Performance

  • Sub-millisecond response times
  • Optimized database queries with proper indexing
  • Efficient collision handling for unique link generation
  • Memory efficient with minimal resource usage

🀝 Contributing

We love contributions! Whether it's:

  • πŸ› Bug reports
  • πŸ’‘ Feature requests
  • πŸ“– Documentation improvements
  • πŸ”§ Code contributions

Check out our contribution guidelines and join our Discord community!

πŸ“„ License

Apache License 2.0 - feel free to use ShortGic in your projects, commercial or otherwise.


Ready to shorten your first URL? 🎯

docker run -d -p 8000:8000 smartgic/shortgic:latest

Made with ❀️ by the Smart'Gic team

About

ShortGic is a blazingly fast, enterprise-ready URL shortener built with modern Python. Perfect for developers, businesses, and anyone who needs reliable link management.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors