/Shortlink-System

⚠️ DEPRECATED ⚠️ — A minimalist, self-hosted URL-shortener service for managing shortlinks.

Primary LanguageHTML

Shortlink-System

A minimalist, self-hosted URL-shortener service for managing shortlinks.

⚠️ This is no longer used or maintained. Hence, I do not recommend using this in production!

However, I created a successor of this software that is up to date and has many more features.

Please visit https://github.com/fabiancdng/Shortinator.

Features

Admin panel

Screenshot of admin panel

Screenshot of shortlink create modal

Optional delay before redirect

Screenshot of shortlink delay page

Deployment

Config file

Rename config.template.py to config.py and specify your settings in that file.

Testing/trying out the app

You can run the app.py using python3 app.py or python app.py for development or testing purposes. Keep in mind that doing so is not a proper way of deploying it for production use.

Deploying the web app

Although a Flask app comes with a built-in development server, you shouldn't use that in production.

A proper way to deploy a Flask app would, for instance, be Apache and mod_wsgi or standalone WSGI containers like Gunicorn or Gevent.

The entrypoint of this app is app.py.

API docs

Shortlink-System provides a REST API that you can use for creating shortlinks or looking up what's behind a shortlink.

Creating a shortlink

[POST] /api/create

You have to provide a valid JSON body in your request.

Example:

{
    "longlink": "https://github.com/fabiancdng",
    "delay": "0"
}

This endpoint returns the unique part of a shortlink as plain text.

Example:

1d03

Looking up a shortlink

[GET] /api/get/SHORTLINK

Replace SHORTLINK in the URL with the unique part of the shortlink you'd like to look up.

This request doesn't need a body.

The response looks like this (using the example above):

{
    "created": "Mon, 26 Jul 2021 18:21:15 GMT",
    "delay": 0,
    "id": 3,
    "redirect": "https://github.com/fabiancdng",
    "short": "1d03"
}

Copyright (c) 2021 Fabian Reinders