Skip to content

michael-borck/slinkr

Repository files navigation

css flask flask-bcrypt flask-login html python qr-code-generator tinydb url-expansion url-shortener

Build Status License: MIT

Slinkr

Stretch. Shrink. Share.

A sleek, Flask-powered web app for shortening, expanding, QR-coding, and validating URLs.


📋 Table of Contents

  1. Demo
  2. Features
  3. Tech Stack
  4. Getting Started
  5. Usage Examples
  6. Deployment
  7. Contributing
  8. License

📷 Demo

Slinkr Interface


🚀 Features

Public (No Account Required)

  • Expand URLs – Reveal full links.
  • QR Code Generator – PNG/SVG output, logo optional.

Verified Users

  • URL Shortener – Create branded short links (/abc123).
  • Basic Link Checker – HTTP status & reachability tests.

Admin-Only

  • User Management – View, verify, or delete users via /admin/users.
  • Rate Limiting Controls – Fine-tune abuse protection.

🛠 Tech Stack

  • Backend: Flask, TinyDB, Flask-Login, Flask-Bcrypt, Flask-Limiter
  • Frontend: TailwindCSS, Vanilla JS
  • QR Codes: qrcode + Pillow
  • Utilities: requests, shortuuid

📦 Getting Started

Configuration

Create a .env file in your project root:

SECRET_KEY=your_super_secret_key
APP_BASE_URL=http://localhost:5000

Run Locally

git clone https://github.com/your-username/slinkr.git
cd slinkr
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python app.py

First user to register becomes an admin and is auto-verified. Subsequent users require admin approval.


💻 Usage Examples

  • Shorten a URL

    curl -X POST "$APP_BASE_URL/api/shorten" \
      -H "Authorization: Bearer $TOKEN" \
      -d "url=https://example.com"  
    # → {"short_url":"http://.../Ab3XyZ"}
  • Generate a QR Code

    curl "$APP_BASE_URL/api/qrcode?url=https://example.com" \
      --output qr.png
  • Check a Link

    curl -X POST "$APP_BASE_URL/api/check" \
      -H "Authorization: Bearer $TOKEN" \
      -d "url=https://example.com"

🚀 Deployment

  • Use Gunicorn + Nginx or Caddy.

  • Do not run app.py with debug=True in production.

  • Swap TinyDB for PostgreSQL/SQLite for higher scale.

  • Configure Flask-Limiter with Redis:

    limiter = Limiter(app, storage_uri="redis://localhost:6379")

🤝 Contributing

Please read our Code of Conduct first, then:

  1. Fork the repo
  2. Create a feature branch
  3. Run tests: pytest
  4. Open a Pull Request

📄 License

MIT © Michael Borck

About

Shortens URLs and generates QR codes with user authentication, link management, and URL expansion capabilities built with Flask and TinyDB.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors