Git Product home page Git Product logo

bus-php's Introduction

BUS logo

Basic URL Shortener

JavaScript Style Guide code style: prettier GitHub code size in bytes GitHub Workflow Status (main)

No-Frills Short URLs

The simplest of URL shorteners for self-hosted users. No analytics. No complex installation.

Features

  • Extremely light-weight (public site is <4KB)
  • Automatic light and dark themes
  • Simple, intuitive dashboard

Example

For screenshots of the dashboard, check out the Wiki.

Tech Stack

Pre-requisites

  • A domain for your short URLs, e.g. example.com
  • A seperate domain for the dashboard to manage short URLs, e.g. dash.example.com
  • A web server like Apache or NGINX
  • Node.js
  • PHP
  • HTTPS Certificates for each domain

Installation

  1. Clone the repository

    $ git clone https://github.com/aensley/bus-php
  2. Install dependencies

    $ npm ci
  3. Configure your installation

  4. Build the site

    $ npm run build

Updates

  1. Update the repository

    $ git pull
  2. Update dependencies

    $ npm ci
  3. Rebuild the site

    $ npm run build

Server Setup

The built site will be available in two directories:

  1. dist/public/ - This is for the domain hosting BUS itself, e.g. https://example.com
  2. dist/dash/ - This is for the domain hosting the BUS dashboard, where the short URLs will be created and managed, e.g. https://dash.example.com

Example configs are included for apache for both the public and dash sites.

Authentication

You will need to setup some form of authentication in front of the dashboard domain. The example config uses basic auth.

Configuration

.env.json

In the dist/ folder, you must create a .env.json file with the site configuration.

An example .env.json file is included for reference.

Settings

Setting Required Default Description
public-domain Yes None The domain for your URL shortener. This will be used as the base for your short URLs.
dash-domain Yes None The domain for your dashboard to create and manage short URLs.
short-code-length No 4 The length to use for automatically generated short-codes.
link-to-dash No false Set to true to show a link to your

Application Data

The only data stored by this application are the short URLs, the long URLs they link to, and the timestamp of when they were created. All of this is stored in a single JSON file.

.data.json

In the dist/ folder you will need to create a .data.json file. The .data.json file must be writeable by the web server user.

This file contains a JSON-formatted list of all short URLs added to your site. Each entry has the short-code as its key and the following properties:

  • l: The long URL.
  • c: Timestamp representing when the short URL was created.

If you lose this file, you lose your short URLs. It is a good idea to regularly backup this file.

bus-php's People

Contributors

aensley avatar

Watchers

 avatar  avatar

bus-php's Issues

Make PWA

Add meta data to make the dashboard an installable web app.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.