Getting started

This page uses the images built by this fork:

Image Contents Port
ghcr.io/bahadirdogru/quark The API and redirect server 8080
ghcr.io/bahadirdogru/quark-panel The web panel as static files 8080

The bhdr tag follows the fork’s main branch. To pin a build, use its sha-<12-character commit> tag. See About this fork.

Run the server

QUARK_KEY is the secret permutation key, a decimal u64. Changing it remaps every code, so generate it once and keep it.

export QUARK_KEY=$(od -An -N8 -tu8 /dev/urandom | tr -d ' ')
export QUARK_ADMIN_TOKEN=$(openssl rand -hex 32)

docker run -d --name quark \
  -p 127.0.0.1:8080:8080 \
  -v quark-data:/data \
  -e QUARK_KEY="$QUARK_KEY" \
  -e QUARK_ADMIN_TOKEN="$QUARK_ADMIN_TOKEN" \
  ghcr.io/bahadirdogru/quark:bhdr

This starts the default setup: an embedded LMDB store in the quark-data volume and no external services.

Without QUARK_ADMIN_TOKEN, anyone who can reach the server can create links, and the admin endpoints are disabled.

curl -X POST localhost:8080/ \
  -H "x-admin-token: $QUARK_ADMIN_TOKEN" \
  -H 'content-type: application/json' \
  -d '{"url": "https://example.com/some/very/long/path"}'
# => {"code":"01aB2Cd","url":"https://example.com/some/very/long/path"}

curl -i localhost:8080/01aB2Cd     # use the code returned above: 302 with Location
curl localhost:8080/health         # ok

The HTTP API lists every route and request field.

Add the web panel

The panel image is built to call the API on its own origin. Serve both from one hostname and let a reverse proxy send the panel’s routes to quark-panel and everything else to quark. The files below are an example with Caddy; replace go.example.com with your domain and adapt them to your proxy.

compose.yml:

services:
  quark:
    image: ghcr.io/bahadirdogru/quark:bhdr
    restart: unless-stopped
    environment:
      QUARK_KEY: ${QUARK_KEY:?}
      QUARK_ADMIN_TOKEN: ${QUARK_ADMIN_TOKEN:?}
      QUARK_SIGNING_KEY: ${QUARK_SIGNING_KEY:?}
      QUARK_PUBLIC_HOST: go.example.com
    volumes:
      - quark-data:/data

  panel:
    image: ghcr.io/bahadirdogru/quark-panel:bhdr
    restart: unless-stopped

  caddy:
    image: caddy:2
    restart: unless-stopped
    ports: ["80:80", "443:443"]
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro
      - caddy-data:/data

volumes:
  quark-data:
  caddy-data:

Caddyfile:

go.example.com {
    @panel {
        method GET HEAD
        path / /login /links /links/* /webhooks /extensions /extensions/* /import /tokens /pixels /analytics /app-links /assets/* /favicon.svg /icons.svg
    }
    reverse_proxy @panel panel:8080
    reverse_proxy quark:8080
}

QUARK_SIGNING_KEY signs the unlock cookie of password-protected links and the session cookie. Generate it with openssl rand -base64 32, keep all three secrets in a .env file outside version control, then start the stack:

docker compose up -d

Open https://go.example.com/ and sign in with QUARK_ADMIN_TOKEN, or set up OIDC login.

Because the panel and the short links share a hostname, a custom alias equal to a panel route (login, links, webhooks, extensions, import, tokens, pixels, analytics, app-links) is answered by the panel. Do not use those as aliases.

Next steps

Edit on GitHub