talira

The definitive self-hosted URL shortener

open sourceMITself-hostablefree

Shlink is a self-hosted URL shortener written in PHP that serves short links under your own domains, with a REST API and a command-line tool for everything, and shlink-web-client, a progressive web app for managing several Shlink servers that you can self-host or use at app.shlink.io. Every visit is tracked with anonymised stats, bot detection and geolocation (a free MaxMind GeoLite2 key or Cloudflare's location headers), and links can have custom or multi-segment slugs, tags, titles, expiry dates, visit limits, QR codes and rules that redirect by device, language, query parameter, IP address or country. It supports multiple domains, API keys limited to one domain or to their own links, imports from Bitly, YOURLS, Kutt, CSV and other Shlink instances, and publishes real-time events to Mercure, RabbitMQ or Redis pub/sub. It runs with the official Docker image (RoadRunner) or from a dist file on MySQL, MariaDB, PostgreSQL or SQL Server, and is MIT-licensed by Alejandro Celaya, with no paid edition.

Ways to install

Problems it solves

  • a self-hosted Bitly alternative so our short links live on our own domain
  • shorten links for marketing campaigns and see how many people clicked, from which countries
  • create short URLs from our backend through a REST API with an API key
  • send iPhone users to the App Store and Android users to Google Play from one link
  • redirect visitors to a different page depending on their browser language
  • short links that stop working after a date or a number of clicks
  • run branded short links on several domains from one installation
  • give each team an API key that can only create links on its own domain
  • migrate thousands of links and their stats off Bitly or YOURLS without breaking them
  • count how many times a newsletter was opened with a tracking pixel
  • exclude bots and crawlers from our link click statistics
  • get notified in real time on our message queue whenever someone clicks a short link
  • send short-link visits to Matomo so they show up with the rest of our analytics
  • manage our short links from the terminal or a shell script
  • a free open source URL shortener that runs in a Docker container with PostgreSQL

View all 20 problems

Features

  • short URLs under your own domains, with generated codes or custom and multi-segment slugs
  • REST API with an OpenAPI spec, and a CLI that does the same (API key management is CLI-only)
  • shlink-web-client, a progressive web app that manages several Shlink servers, self-hosted or at app.shlink.io
  • visit tracking with anonymised stats, orphan visits and potential-bot detection
  • visitor geolocation with a MaxMind GeoLite2 database (free licence key) or Cloudflare location headers
  • dynamic redirect rules by device, language, query parameter, IP address, country or city
  • short URL titles (fetched automatically if wanted), tags, expiry dates and maximum visits
  • query parameter and extra path forwarding to the long URL
  • multiple domains, with per-domain fallback redirects
  • API key roles: only links the key created, only one domain, or no orphan visits
View 8 more
  • import from Bitly, YOURLS, Kutt, a standard CSV or another Shlink instance
  • real-time updates through a Mercure hub, RabbitMQ or Redis pub/sub
  • email open tracking through a 1-pixel image at /track
  • QR codes at /qr-code with size, format, margin and colours (deprecated since 4.5.0)
  • sends visits to Matomo
  • official PHP and JavaScript SDKs
  • MySQL, MariaDB, PostgreSQL and Microsoft SQL Server, plus SQLite for testing
  • official Docker image on RoadRunner; also runs on FrankenPHP or a classic web server

Limitations

  • No webhooks: real-time events go through a Mercure hub, RabbitMQ or Redis pub/sub instead, and only with the RoadRunner runtime89
  • SQLite isn't supported for production: use MySQL, MariaDB, PostgreSQL or Microsoft SQL Server10
  • No visitor geolocation out of the box: it needs a free MaxMind GeoLite2 licence key or Cloudflare in front11

Capabilities

Has an APIplan not known
Has a command line toolplan not known
Has official SDKsplan not known

Alternatives

The same job

These do what Shlink does.

  1. Kutt Free modern URL shortener
  2. Dub Link attribution platform: short links, conversion tracking and affiliate programs
  3. YOURLS Your Own URL Shortener
  4. Bitly Create, share, and track short links and QR Codes
  5. Short.io URL shortener with custom domains & analytics
  6. Chhoto URL Small self-hosted URL shortener written in Rust

Compare Shlink with the top 3