No description
  • TypeScript 38%
  • CSS 21.6%
  • JavaScript 13.3%
  • PowerShell 12.2%
  • Python 11%
  • Other 3.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-17 00:57:00 -05:00
.forgejo/workflows Push 2026-11-16 23:30:03 -05:00
brand Update Website 2026-11-17 00:37:15 -05:00
extension Update Extension 2026-11-17 00:08:26 -05:00
images Update README.md 2026-11-17 00:57:00 -05:00
pterodactyl Update website 2026-11-17 00:31:04 -05:00
scripts Update Extension 2026-11-17 00:08:26 -05:00
web Update Website 2026-11-17 00:37:15 -05:00
.gitignore First Push 2026-11-16 22:31:48 -05:00
gen-icons.ps1 Update website 2026-11-17 00:31:04 -05:00
README.md Update README.md 2026-11-17 00:57:00 -05:00

ShortLink

Self-hosted URL shortener: Next.js web app, Postgres storage, Firefox extension, and a Pterodactyl egg for deploy.

Live instance pattern: shorten links at your BASE_URL, manage them at /admin, install the extension from Forgejo releases.

Screenshots

URL bar page action:

ShortLink icon in the Firefox URL bar

Extension popup:

ShortLink popup ready to shorten a URL

Custom code (hover the hint under the button):

ShortLink popup with custom code field

Settings:

ShortLink extension settings with dark mode

Features

  • Shorten any URL from the homepage (optional custom code)
  • GET /:code redirects and tracks clicks
  • Password-protected /admin dashboard (list + delete links)
  • Firefox MV3 extension — toolbar popup, URL-bar page action, context menus
  • Auto-built .xpi releases on Forgejo (optional AMO signing)
  • Pterodactyl egg: git pull → build → start on each boot

Project layout

web/           Next.js 15 app (UI, API, admin, Postgres store)
extension/     Firefox Manifest V3 add-on
images/        README screenshots
brand/         Source SVG icons (site + extension)
pterodactyl/   Egg + entrypoint for panel hosting
scripts/       XPI packaging + AMO signing helpers
.forgejo/      Release workflow

Web app

Requirements

  • Node.js 22+
  • Postgres

Setup

cd web
npm install
cp .env.example .env.local

Edit .env.local:

Variable Purpose
BASE_URL Public origin used in generated short URLs (e.g. https://short.example.com)
PORT Listen port (default 3000)
DATABASE_URL Postgres connection string
ADMIN_PASSWORD Password for /admin (leave empty to disable login)
FORGEJO_API_URL Optional — latest-release download on the homepage
FORGEJO_REPO Optional — owner/repo for that release lookup

Create the database (example):

sudo -u postgres createuser shortlink
sudo -u postgres createdb -O shortlink shortlink
sudo -u postgres psql -c "ALTER USER shortlink PASSWORD 'shortlink';"

Run

npm run dev      # http://localhost:3000

Production:

npm run build && npm start

Tables are created automatically on first use.

API

POST /api/shorten

{ "url": "https://example.com/long", "customCode": "optional" }

Response:

{ "code": "Ab12Cd", "shortUrl": "https://your.host/Ab12Cd" }

GET /:code — 302 to the stored URL (increments clicks).

Firefox extension

Points at your ShortLink instance (default host permission: https://short.hexium.cc/*).

Temporary install (dev)

  1. Run the web app.
  2. Firefox → about:debugging → This Firefox → Load Temporary Add-on…
  3. Pick extension/manifest.json.

Release install

Download the signed .xpi from the repo’s Forgejo releases and open it in Firefox.

Unsigned builds: load via about:debugging, or use Firefox Developer Edition / Nightly.

What it does

  • Popup to shorten the current tab (or a pasted URL)
  • Optional custom code + dark mode in settings
  • Context menu on links / page
  • Page action in the URL bar on http(s) pages

Releases (Forgejo Actions)

Workflow: .forgejo/workflows/release-extension.yml

  • Push to main (extension/scripts changes) → auto-bumps patch version, builds .xpi, publishes a release
  • Tag vX.Y.Z → release for that version
  • Manual run → enter a version; creates v<version> + release

Optional AMO signing: set repository secrets AMO_JWT_ISSUER and AMO_JWT_SECRET from AMO API keys.

Artifacts look like shortlink-extension-vX.Y.Z-signed.xpi (or unsigned if signing is skipped).

Icons

# from repo root (needs web/ node_modules for @resvg/resvg-js)
powershell -ExecutionPolicy Bypass -File .\gen-icons.ps1

Renders brand/shortlink-icon.svg → web favicons, and brand/shortlink-icon-extension.svg → extension PNGs.

Pterodactyl

Import pterodactyl/egg.json. On each start the entrypoint pulls the configured Forgejo branch, installs, builds, and runs the app.

Set at least:

  • GIT_ADDRESS / GIT_BRANCH / optional GIT_TOKEN
  • DATABASE_URL
  • BASE_URL
  • ADMIN_PASSWORD