Open-source URL shortener - Solution for URL shortening: nginx, postgres, json.

Includes: Website, android application, and simple bash script for url shortening.


Live example: hda.me

To use it as service

To setup it yourself


Configuration examples location and installation

Once you have nginx and the needed modules installed you can start nginx with the the configuration from /conf and /website folders

You also need to setup a database in your PostgreSQL-server and create separate table, don't forget set password. Use the /config/database.sql file to do it for you. After you are done adjust the settings to your environment in the nginx configuration.
Creating user and database:

CREATE USER "user" WITH PASSWORD 'password';  
CREATE DATABASE databasename WITH OWNER "user";


psql -h localhost -d databasename -U user -f database.sql


  1. Script
    Edit host, chmod 755, and copy to /usr/local/bin/
    Or you can install it via PPA:

    sudo apt-add-repository ppa:hda-me/urlhda
    sudo apt-get update
    sudo apt-get install urlhda
    # 5 symbols uid (default)  
    urlhda http[s]://your_long_url_here  
    # To generate Strong URL (15 symbols uid)  
    urlhda -s http[s]://your_long_url_here 
  2. Website
    Edit index.html to change appearance for your needs and your done
  3. Android app
    Install app and change hostname URL in application Settings (gear icon)

How it works

You can shorten URLs with a POST-request:

  curl -X POST https://website.name/add?url=http://add.me

This will give you JSON-response back with the generated 5 character UID:


With that you can go to for example to https://website.name/abcd5 and you will be redirected to http://add.me


Original idea: Sebastian Gräßl, forked from https://github.com/bastilian/sebas
Bitcoin donate: 1N5czHaoSLukFSTq2ZJujaWGjkmBxv2dT9