SURL is a self-hosted URL shortener with a built-in admin panel.
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.
| Variable | Purpose |
|---|---|
APIKEY | API key for /api/*, sent using the x-api-key header |
HOST | Public hostname and optional port used in short URLs; omit the scheme and path |
PANEL_ADMIN_NAME | Admin panel username |
PANEL_ADMIN_PASSWORD | Admin panel password |
PANEL_SESSION_SECRET | Session signing secret; use at least 16 random characters |
| Variable | Default | Purpose |
|---|---|---|
URL_SCHEME | http | Scheme used in generated short URLs |
PORT | 8080 | Container listening port |
STORE_DRIVER | sqlite | Storage backend: sqlite, postgres, or valkey |
SQLITE_PATH | /data/surl.sqlite3 | SQLite database path inside the image |
MAX_TTL_HOURS | 168 | Maximum temporary-link lifetime in hours |
TRUST_PROXY_HEADERS | false | Trust forwarded client-address and protocol headers |
PANEL_SECURE_COOKIE_ALWAYS | false | Require HTTPS for panel session cookies |
QR_LOGO | Built-in logo | PNG file path or HTTP(S) URL for branded QR codes |
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.
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.
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.
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.
Append .png to a short link to retrieve its QR image:
http://localhost:8080/abc.png
Available presets:
default: standard square QRbranded: rounded QR with a logoprint: higher-resolution branded QRthermal58: for 58 mm receipt printersthermal80: for 80 mm receipt printersthermal: alias for thermal80Example 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: process liveness/ready: readiness, including storage availabilityUse arivia/surl:latest for the latest published build, or pin a published
version tag for controlled deployments.
docker pull arivia/surl:latest