- AGPL-3.0-only
- Rust
- Fork of lucasolopes/quark
Short links, computed, not stored
quark is a self-hosted URL shortener. A short code is a keyed permutation of the link's integer id, so there are no collision checks and no index from code to id. By default it runs as a single binary with an embedded store and no external services.
# QUARK_KEY is a secret decimal u64. Keep it stable once links exist.
export QUARK_KEY=$(od -An -N8 -tu8 /dev/urandom | tr -d ' ')
docker run -d --name quark -p 127.0.0.1:8080:8080 \
-v quark-data:/data -e QUARK_KEY="$QUARK_KEY" \
ghcr.io/bahadirdogru/quark:bhdr
curl -X POST localhost:8080/ -H 'content-type: application/json' \
-d '{"url": "https://example.com/some/very/long/path"}'
How it works
One design choice: the code is a function of the id.
Computed codes
A Feistel network with an add-rotate-xor round function (6 rounds, arxid spec v2) maps the id to a 7-character base62 code and back. It is a bijection, so two ids never share a code.
One binary by default
Embedded LMDB for links and analytics, an in-process cache, nothing else to run. The redirect decodes the code, checks the cache and falls back to one store read.
Opt-in backends
Set a variable to add Postgres for shared storage, Valkey for a second cache tier, or ClickHouse for click analytics. Each is selected independently.
Aliases and expiry
Custom aliases, a TTL or a visit limit, and an optional fallback URL for expired links. Redirects carry a TTL-aware Cache-Control header.
QUARK_KEY. The measurements and method are described in Architecture.
Features
All of it is in the AGPL core.
Redirect rules
Send visitors to different destinations by country or device.
A/B testing
Weighted destination variants with per-variant click counts.
Password links
An argon2id-hashed password with a built-in interstitial page.
Deep linking
iOS and Android app destinations and hosted app-association files.
Click analytics
Cookieless, server-side capture recorded off the redirect path.
Webhooks
Signed events to your endpoints, plus Slack, Discord and Telegram messages.
Conversion forwarding
Server-side GA4 and Meta Conversions API, with no client-side pixel.
API tokens
Named tokens with scopes and an optional per-token rate limit.
OIDC login
Sign in to the panel with your own identity provider.
Import
Bulk import CSV or JSON exports from Bitly, Kutt, YOURLS or a generic file.
Link health
Optional background checks that report broken destinations.
Google Sheets
Mirror the link catalog into a spreadsheet you own.
A web panel (React, English and Turkish) manages links, tags, folders, QR codes and statistics. It ships as a separate static image; the quark binary stays API-only.
What this fork changes
A fork of lucasolopes/quark, the project written by Lucas Olopes.
| Area | In this fork |
|---|---|
| Enterprise Edition | Removed: src/ee/, web/src/ee/, the ee cargo feature and the license and plan seams. |
| License | Only the AGPL-3.0-only core remains. |
| Redirect options | QUARK_FORWARD_QUERY and QUARK_NOT_FOUND_URL, also proposed upstream. |
| Images | ghcr.io/bahadirdogru/quark and ghcr.io/bahadirdogru/quark-panel, built for amd64 and arm64. |
| Languages | English documentation; panel in English and Turkish. |