HUB
Sign inSign up

arivia/surl

By arivia

•Updated about 2 months ago

URL Shortener

Image
Web analytics
0

768

arivia/surl repository overview

⁠SURL

SURL is a self-hosted URL shortener with a built-in admin panel.

  • Short links and QR code downloads
  • Temporary and permanent links
  • API key protected REST API
  • Admin panel for creating and managing links
  • Embedded SQLite storage, with PostgreSQL and Valkey support
  • A single container serving the API, panel, and documentation

⁠Quick Start

docker run -d \
  --name surl \
  --restart unless-stopped \
  -p 8080:8080 \
  -v surl-data:/data \
  -e APIKEY=replace-with-a-random-api-key \
  -e HOST=localhost:8080 \
  -e PANEL_ADMIN_NAME=admin \
  -e PANEL_ADMIN_PASSWORD=replace-with-a-strong-password \
  -e PANEL_SESSION_SECRET=replace-with-a-long-random-secret \
  arivia/surl:latest

Open:

For production, set HOST to your public hostname and URL_SCHEME=https.

⁠Configuration

⁠Required
VariablePurpose
APIKEYAPI key for /api/*, sent using the x-api-key header
HOSTPublic hostname and optional port used in short URLs; omit the scheme and path
PANEL_ADMIN_NAMEAdmin panel username
PANEL_ADMIN_PASSWORDAdmin panel password
PANEL_SESSION_SECRETSession signing secret; use at least 16 random characters
⁠Common Options
VariableDefaultPurpose
URL_SCHEMEhttpScheme used in generated short URLs
PORT8080Container listening port
STORE_DRIVERsqliteStorage backend: sqlite, postgres, or valkey
SQLITE_PATH/data/surl.sqlite3SQLite database path inside the image
MAX_TTL_HOURS168Maximum temporary-link lifetime in hours
TRUST_PROXY_HEADERSfalseTrust forwarded client-address and protocol headers
PANEL_SECURE_COOKIE_ALWAYSfalseRequire HTTPS for panel session cookies
QR_LOGOBuilt-in logoPNG file path or HTTP(S) URL for branded QR codes

⁠Persistent Storage

SQLite is the default and requires no separate database container.

Mount a writable volume at /data:

-v surl-data:/data

The database is stored at /data/surl.sqlite3. Back up this volume before upgrades.

Upgrading from Deno KV: KV_PATH is no longer used. Existing Deno KV databases are not automatically migrated to the new SQLite store. Preserve your old database and migrate its records separately before switching traffic.

⁠PostgreSQL

Set:

STORE_DRIVER=postgres
POSTGRES_URL=postgres://surl:password@postgres:5432/surl
POSTGRES_SSL=require

Provision the database and user before starting SURL. The application runs its schema migrations at startup.

⁠Valkey

Set:

STORE_DRIVER=valkey
VALKEY_URL=valkey://valkey:6379/0
VALKEY_KEY_PREFIX=surl

Configure persistence and avoid eviction policies that could remove permanent links. When upgrading, update all SURL writers together.

For multiple SURL instances, use PostgreSQL or Valkey and share the same PANEL_SESSION_SECRET across instances. Rate limits remain per instance.

⁠HTTPS and Reverse Proxies

When serving SURL over HTTPS, set:

URL_SCHEME=https
PANEL_SECURE_COOKIE_ALWAYS=true

Set TRUST_PROXY_HEADERS=true only when a trusted proxy overwrites X-Forwarded-For, sanitizes X-Forwarded-Proto, and prevents direct client access to the backend.

⁠QR Codes

Append .png to a short link to retrieve its QR image:

http://localhost:8080/abc.png

Available presets:

  • default: standard square QR
  • branded: rounded QR with a logo
  • print: higher-resolution branded QR
  • thermal58: for 58 mm receipt printers
  • thermal80: for 80 mm receipt printers
  • thermal: alias for thermal80

Example download:

http://localhost:8080/abc.png?preset=print&download=1

To supply a custom logo, mount a PNG and set QR_LOGO to its container path. Use an image with a longest side of 64–2048 pixels and a file size of at most 1 MiB. A 512 × 512 image with bold shapes is recommended.

Logos load at startup. If loading fails, SURL uses its built-in logo.

⁠Health Checks

  • /health: process liveness
  • /ready: readiness, including storage availability

⁠Image Tags

Use arivia/surl:latest for the latest published build, or pin a published version tag for controlled deployments.

Tag summary
Recent tags
Content type
Image
Digest
sha256:250926e03…
Size
74.3 MB
Last updated
about 2 months ago
docker pull arivia/surl:latest