Skip to content

jacobeus/shortenr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Make your own URL shortener in 3 minutes

Shortenr is a 14-line web application allowing you to have your own private URL shortener.

Tools/services

  • Sinatra as web framework
  • DataMapper as ORM
  • Heroku.com for the free hosting
  • ZerigoDNS for DNS

Prerequisites

And to test it locally:

  • Ruby
  • Some gems: sudo gem install sinatra dm-core dm-validations dm-aggregates do_mysql

Usage

Configure the app on Heroku

git clone http://github.com/njacobeus/shortenr.git
heroku create {name_of_your_shortener}
heroku addons:add custom_domains
heroku domains:add {your_domain_name}
heroku addons:add zerigo_dns
git push heroku master

Create the “shortener” database locally and send it to Heroku

  1. Either with Datamapper:
    • Add the line “DataMapper.auto_migrate” in shortener.rb
    • Launch it once locally (ruby shortener.rb) and stop it
    • Remove the line
  2. Or manually in your MySQL client: you only need an “urls” table with the 3 fields (id, target, short) as described in shortener.rb.

Then send it to Heroku:

heroku db:push mysql://root@localhost/shortener

Submit URLs to shorten via your “secret” access URL:

http://{your_domain_name}/privatesubmit?url={url_toadd}

(you can obviously change that URL to make it a little bit more secret)

Demo

You can test it in action on http://tu.tl ; there is no public page, so you have to enter new URLs via

http://tu.tl/privatesubmit?url={url_toadd}

About

Your own free private URL shortener

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages