Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.
/ shortlink Public archive

Lightning fast, self-hostable, opensource link shortening API made with Python ⚡🔗

License

Notifications You must be signed in to change notification settings

berrysauce/shortlink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

         __               __  ___       __  
   _____/ /_  ____  _____/ /_/ (_)___  / /__
  / ___/ __ \/ __ \/ ___/ __/ / / __ \/ //_/
 (__  ) / / / /_/ / /  / /_/ / / / / / ,<   
/____/_/ /_/\____/_/   \__/_/_/_/ /_/_/|_|  

Libraries.io dependency status for GitHub repo GitHub release (latest by date) GitHub repo size Python version


shortlink

Self-hostable link shortening API made with Python

Ever wanted to have your own link shortener for free? With shortlink you can turn long links like myexampledomain.com/this-is-an-example-post to example.co/324nk1. This has multiple advantages: you can write down and share the links much easier, they look prettier, and you can fit the links character-limited fields (e.g. Tweet).

Shortlink is easy to install and host on any Python 3.7 and pip capable device. Also, shortlink is efficient even on old or slow systems and is made of relatively simple code.

Requirements

  • Python 3 and pip
  • a domain (optional, otherwise use your IP)
  • a computer

Installation

First of all, clone the GitHub repository with

git clone https://github.com/berrysauce/shortlink.git

(if don't have git installed, install it like this)

Then, navigate to the repository folder with

cd shortlink

Now, let's install the requirements needed for shortlink with

pip3 install -r requirements.txt

After that, you should be set to begin the shortlink setup with

python3 main.py

(This is also the command to start your script)

The program should prompt you with a few questions. Please read through them carefully!

If the server got started, you're done! Shortlink is now running. You can stop it with Ctrl+C. If you need to change something in your config, edit it with nano sl/config.ini. Please do NOT change the key value since this will lock you out of your API! If you need to change your password, backup the db.json file, re-install shortlink and put it back in the sl folder.

Using the API

I'd recommend you to access the /docs page. There you can try out the API and see how to use it in your code. This page is public, that's why you need the password for certain things like creating a link and viewing all links (if you configured it that way).

Using shortlink with a custom domain

Set the host to your domain (without http(s)://) and your port to 80. Make sure your domain points to your server IP. If you're using Cloudflare to manage your DNS, please disable the orange cloud symbol (so traffic won't go through the Cloudflare network) since Shortlink doesn't currently support SSL.

Security

If you find any vulnerabilities, please send me an Email: support@[removeifhuman]berrysauce.me.

Credits

Thanks to: