Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/danyim/yotta-url

A URL e x p a n d e r built in Node
https://github.com/danyim/yotta-url

heroku mongodb nodejs url-lengthener-just-because url-unshortener

Last synced: 8 days ago
JSON representation

A URL e x p a n d e r built in Node

Awesome Lists containing this project

README

        

![https://blog.daniely.im/wp-content/uploads/2016/08/yt-logo-1024x229.png](https://blog.daniely.im/wp-content/uploads/2016/08/yt-logo-1024x229.png)

[![Build Status](https://travis-ci.org/danyim/yotta-url.svg?branch=master)](https://travis-ci.org/danyim/yotta-url)

**[Live Link](https://yotta-url.herokuapp.com/)**

> **Yotta** is the largest decimal unit prefix in the metric system, denoting a factor of 10^24 or 1000000000000000000000000

URL shortening is _so_ yesterday. What if we instead _lengthened_ a URL into a giant wall of unreadable hashed text? yotta-url does just that! It will take your URL and expand it to the maximum allowable length (a 2083-character limit imposed by the stepchild of browsers).

The engine features a complete, [cryptographically](https://en.wikipedia.org/wiki/RC4#Key-scheduling_algorithm_.28KSA.29)-[sound](https://en.wikipedia.org/wiki/RC4#Pseudo-random_generation_algorithm_.28PRGA.29) [hashing function](https://en.wikipedia.org/wiki/Merkle%E2%80%93Damg%C3%A5rd_construction) that will turn your run-of-the-mill `http://google.com` into the following

```LR0aq2JaMzW6J9FfYco3DZi6bg5R7VzGQfDHVPEckhRD01spJmlt5Qve9Xo4q8ZhzswyMF21yGaxAJgIkjqICfUKmaw3QdHb3cXgjR11SR8Zr2zNbIM4GrG7SlLbVnnnhIhhMcYaZsoSTH8O2l9A7CgyOTAaqnu4powWnysvdYN8topfNmm5QOuUWvrbL3DI8cv9G7yst21MTYDvdkhbxFwPFsUySGBi4O5duJHdRWTjpgDLZp86a8fWTxkYFcJWx7YewlmGQNVBSBvVl2wBmRtiaJ6ji9T7edyXblglKhgv5G6RTT9LKLgsBHXwH5GCrHKvpJ9a64pSGi7TYn2PyhkFc6FeyuE2YOeN0LZZ3eXOZbNGgil72SCm19i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WO9Ef5fPK6ubUm1q1SJIsDtz38YWzjroalRzxzAt6MnIXG8gdo54eMgxMM8bf4Aci6Va1yGdXW8Xno70qsdESVikeycNFfPQ959bXjvpWGGEqfRI9ZjXkrC0CMB09SuhkmSNDK3dfw2uBYMK0erbDQ7pcQ44JScgLzyJO6lOSeuTpDLUGBAVPosGwfu6Iv8p1W5CItkUlU7Wjy7zGzxA4XQIRf7EWjW2JBXJ1F4Iyug8PPYjke4iP662EvmjG10EFm335ZlyodhbhdM1fzw3Z3OzHdu2YNFOUgcm3tAjrW0yUAJKsSND1wrHlWyBLKxtOoN5nlrFlK8aXdPH9vnDUHwjjhfipcJOuMVzhIzwXRcuSlMat5nwHUD7Zc88IJh4hNEYppyiBRwywOYu7s9AAme9a2N2uN1jAp8hATXBbD0THhcoLcZVxG5t30GPs3CNtiUXWpvkBWtcUmTGbwUWQitMLok2iygw1p7nzEgQfLOxJkbRuNRNW4YDxXggb99vyrDCbHgYUxue1K7KgglDnq9B5JU7p9av3pBaEqETF6DwOxsK5RuoASKn```

Also, the one-way hashing function we're using exhibits an [avalanche effect](https://en.wikipedia.org/wiki/Avalanche_effect), such that appending something as minor as a trailing slash (`http://google.com/`) will result in a vastly different key than the previous:

```L5YhZ2PR5dNhwhZyycu8O8VSG3OVTUbp5ADMgBBcZhB3GUP9yZXGtGeOVeVwqzpenA3CMtDzic7mmfPMXg3zXYEByaaiINHbt4ok9yLwcRsb13ENFEigRHNdi7Q2YnCxhCqiScKojLw22hORM3nqg7YD5CAOWnur9obDuqYYT5uNORpfNO9KlOeCDfrvV3DIycGK91ZQMRhnEyjJRfLkvvxmgsnGbGpW4p7yclWdktT2IEJLFosqfs3STv7sOGgixLYkRTmMpcIiIpqb0f43cc8qyJ6zN9B7j9rWA1UGK2NJ5GZVnQVSahw4BmXwMlj6dHqyp5crKqGSl4sZhY2yyZkbG69v7XEqEUerlkMlsUXT4oNxg3iZ2SHtkJ8awZjW3goIXL6gotT0hRamviHJzP3vk6JZtzlmbl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28bavsARuPf2aCijxs65sIMgPZPXbtgK16wV610SXbW0XFk4VjzNRrSXPeIjFFfBtw5wqnrxpFGX8mDlIIvW8CVU09Xmb7weBbHd9lvnUBK20RXI9dnabgCZHt49pwqzaMnknocWJaX6LjDa8cO4fFlJEAaw7ISWgAzERosgWij7KjKf51Dqzcl4uKF7YMjbsJBUJUbjKwM5iCt3C4D4zJiuIez3hNl0mzP3kbZlImdodhGW1kw5Ef7wyLF1LM9wkNgGY6Y5FcmvnKbLKsQgjcWyRkLybP1X9DDSgdUAKHK50xm9gZ0GBKY6eSJqOV1wJuObzhwly8EcHvl5a7USGPx01SktbI84GQaaYRcS9ZRwim4T5pVYzAh9lcWAoUNOTfRJhv6g8JgUkzEiuLIu9g5ZkmyB7x87MwXF6isUoLf1xjE8fUwUWKQdbwo12C0QgTz5hGit2fAS1JPb88jWN1SlIJgXhYqUcu3YlGrGgUKeSDi6Z6HlOFy98aNAtp7wWBpcWuRJvNsLXYO3BxGPoAZ3d```

Isn't that neat?
Go try a few URLs in the [live demo](https://yotta-url.herokuapp.com/) and share that dope link on Twitter (disclaimer: requires 13 tweets to transmit a yotta URL) ;)

## Requires
- Node >= v6.x, a MongoDB instance with read/write, and a dash of boredom

## Installation
1. Run `npm install` on the root directory to grab dependencies
2. Copy `./.env.sample` to `./.env` and edit the file with your credentials
3. Start the server via `npm run start`
4. Send a GET request to [http://localhost:8080/expand?[your URL here]]()
- It will return a URL you can share
5. Send a GET request to [http://localhost:8080/\[URL code\]]() (replace with your URL code returned from the previous step)
- You will be redirected to the correct URL

## Deployment
- If you want to deploy this to Heroku, upload it as-is and define the following environment variables through the [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli):

`heroku config:set MONGO_HOSTNAME=hostname.mongodb.com/1234 MONGO_USER=user MONGO_PASSWORD=pass`

## License
- MIT