Deploy Shlink
Self-hosted URL shortener with REST API, visit stats and web client
Just deployed
Just deployed
/var/lib/postgresql/data
Shlink Web Client
Just deployed
Deploy and Host Shlink on Railway
Shlink is an open-source, self-hosted URL shortener with a REST API. It creates short links on your own domain, tracks visits (referrers, browsers, optional geolocation), generates QR codes, and supports tags, custom slugs and expiry rules. It comes with an official web client for managing links in the browser.
About Hosting Shlink
Hosting Shlink means running its PHP application server, a SQL database for links and visits, and a way to manage links. This template deploys Shlink 5.1.8 on Railway Postgres and the official Shlink Web Client 4.9.0, both built from a GitHub repo with images pinned by digest. Shlink runs its database migrations on every start and creates an admin API key from a generated secret on first start. The web client is preconfigured with that server and key, and sits behind HTTP basic auth with a generated password, because it hands the API key to the browser. No values have to be entered at deploy time.
Common Use Cases
- Branded short links on your own domain for marketing, social media and printed QR codes
- Tracking clicks per link without a third-party shortener collecting the data
- Creating short links from scripts, CI jobs or other apps through the REST API
Dependencies for Shlink Hosting
- PostgreSQL (Railway Postgres, included)
- A public domain for the Shlink service (a Railway domain is added; a custom domain is recommended)
Deployment Dependencies
- Shlink documentation: https://shlink.io/documentation/
- Shlink environment variables: https://shlink.io/documentation/environment-variables/
- Shlink releases: https://github.com/shlinkio/shlink/releases
- Shlink Web Client: https://shlink.io/documentation/shlink-web-client/
- Template repo and changelog: https://github.com/aalfath/shlink-railway-template
Implementation Details
Services: Shlink (short links and REST API, health check /rest/health), Shlink Web Client (management UI, health check /healthz) and Postgres.
After deploy:
- Open the Shlink Web Client domain and log in as
adminwith theWEB_PASSWORDvalue from that service's Variables tab. - Create links. They are served from the Shlink service's domain.
- For API calls, send the Shlink service's
INITIAL_API_KEYas theX-Api-Keyheader.
To use your own short domain, add it to the Shlink service under Settings, Networking, then set DEFAULT_DOMAIN on the Shlink service to YOUR-DOMAIN. Optional features are plain environment variables on the Shlink service: GEOLITE_LICENSE_KEY (a free MaxMind key) turns on visit geolocation, and DEFAULT_BASE_URL_REDIRECT and DEFAULT_INVALID_SHORT_URL_REDIRECT choose where the bare domain and unknown links send visitors.
Both app services build from the template repo, so new pinned releases arrive as Railway update notices; read the repo's CHANGELOG.md before applying one.
Why Deploy Shlink on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Shlink on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
Shlink Web Client
aalfath/shlink-railway-template