davydog187 / devito

An open-source url shortener written in Elixir and Phoenix, with no need for a separate database

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Devito

An Elixir and CubDB based url shortener.

Interface

Devito is designed to be used with the Devito CLI. Although you can also interface it using HTTP.

Configuration

Authorization is handled via an API token. You must pass auth_token=<VALUE> with each request, and that token will be matched against the ENV VAR AUTH_TOKEN. The values cannot be set to nil.

Configure the application's short_code_chars to a list of values you want the short_code to be generated from.

config :devito, short_code_chars: []

Endpoints

  • GET /api/ index of all links
  • POST /api/link to create a new link. Params: url=URL&short_code=SHORTCODE&auth_token=TOKEN
  • GET /api/SHORTCODE shows info about a link

Deploying to Gigalixir

If you are unfamiliar with Gigalixir, they are a hosting service designed for Elixir. This app will work on the free tier and has no need for a postgres database. Watch this tutorial for more information.

  1. Sign up for an account.
  2. Follow the steps in the Getting Started Guide. Note: The buildpack config are already included in this repo. Also, there is no need to provision a database.
  3. Create a new app.
  4. Set your AUTH_TOKEN from the Gigalixir console > configuration Note: Your auth token will be used to authenitcate all API requests
  5. Deploy the app - It is designed to be deployed using Elixir Releases
  6. Download the Devito CLI
  7. Configure the CLI (./devito config --apiurl <APP URL> --authtoken <TOKEN FROM STEP 4>)
  8. Test it out. ./devito https://supersimple.org sprsmpl

Help Video

An Install walk-through video is available.

Logo Credit

Devito Logo by [https://markfarrisdesign.com](Mark Farris)

Running Locally

To start your Phoenix server:

  • Setup the project with mix setup
  • Start Phoenix endpoint with mix phx.server

Now you can visit localhost:4000 from your browser.

Ready to run in production? Please check our deployment guides.

Learn more

About

An open-source url shortener written in Elixir and Phoenix, with no need for a separate database

License:Apache License 2.0


Languages

Language:Elixir 70.0%Language:CSS 20.0%Language:JavaScript 7.5%Language:HTML 2.5%