Skip to content

Installation

Andrew Ensley edited this page Sep 14, 2023 · 3 revisions

Pre-requisites

  • A domain for your short URLs, e.g. example.com
  • A Cloudflare account

Installation

Follow these steps to setup your own, super-fast URL shortener in minutes.

1. Fork the Repository

Fork this repository to your GitHub account.

2. Setup the Cloudflare Page

  1. Log into the Cloudflare Dashboard
  2. Click Workers & Pages
  3. Click Create Application
  4. Click the Pages tab
  5. Click Connect to Git
  6. Select your repository and click Begin Setup
  7. Leave the defaults for everything, except:
    1. Build command: npm run build
    2. Build output directory: dist
  8. Click Environment variables (advanced) and add the variables you want (DOMAIN at a minimum)
  9. Click Save and Deploy

3. Setup the KV Store

TBA

4. Setup the D1 Database

TBA

5. Setup Access

TBA

Environment Variables

Configuration is performed through Cloudflare Pages' Environment variables.

Environment Variable Required Default Description
DOMAIN YES The domain for your URL shortener. This will be used as the base for your 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 dashboard on the public home page.