blinky

A minimal URL shortener/manager

Stars
1

Blinky

Blinky is a minimal URL shortener/manager.

You can map long urls to specific subpaths (ex. /docs -> https://example.com).

Hosting

Docker

A Docker image is available on Docker Hub as jonahsnider/blinky.

It requires the following environment variables to be set:

  • DATABASE_URL
  • ADMIN_PASSWORD
  • BASE_URL

Please see below installation instructions for information on what these should be defined as.

Without Docker

First time setup

  1. Install Node.js v20

  2. Clone the project

    git clone https://github.com/jonahsnider/blinky.git
    
  3. Install dependencies

    npm ci
    
  4. Build the project

    npm run build
    
  5. Set environment variables

    The server needs a few environment variables to be defined in order to function:

    Variable Description
    DATABASE_URL A MySQL connection URL, following this format
    ADMIN_PASSWORD A password for accessing the admin interface
    BASE_URL A well-formed URL where the service is hosted (ex. https://blinky.example.com)

    You can either define these directly in your system environment, or use a .env file in the project root:

     # .env
    DATABASE_URL=mysql://user:password@host:port/database
    ADMIN_PASSWORD=password
    BASE_URL=https://blinky.example.com
    

    Documentation for how .env is parsed is here.

  6. Run database migrations

    npm run migrate
    

Updating

  1. Pull the latest changes

    git pull
    
  2. Install dependencies

     npm ci
    
  3. Build the project

    npm run build
    
  4. Run database migrations

    npm run migrate
    

Starting the server

Start the server:

npm start

The PORT environment variable can be defined (not in .env) to set what port the server will listen on:

PORT=8080 npm start