Installation

You can run Trelay with Docker Compose (recommended) or build and run the server, frontend, and CLI manually.

Docker (recommended)

Use Docker Compose for a single-command setup. The image builds the Go server and SvelteKit frontend and serves them from one container.

1. Clone and configure

git clone https://github.com/trelay-dev/trelay.git
cd trelay
cp env.example .env

Edit .env and set at least:

  • API_KEY — A secure random string used to authenticate API and dashboard (e.g. generate with openssl rand -hex 32)
  • JWT_SECRET — A secure random string for signing JWT tokens (e.g. openssl rand -hex 32)

Optionally set BASE_URL to your public URL (e.g. https://links.example.com) so short links use that domain.

2. Run

docker compose up -d

The app listens on port 8080. Open http://localhost:8080 for the dashboard. Data is stored in a Docker volume (trelay-data) so it persists across restarts.

Manual setup

For development or when you prefer not to use Docker:

Prerequisites

  • Go 1.21+
  • Bun 1.0+ (for the frontend)
  • SQLite 3
  • Make (optional)

Server

cp env.example .env
# Edit .env with API_KEY and JWT_SECRET
make build-server
./bin/trelay-server

The server runs on http://localhost:8080 by default. Without a built frontend, it will serve the API only; you can develop the frontend separately.

Frontend (development)

cd frontend
bun install
bun run dev

The Vite dev server runs at http://localhost:5173 with hot reload. Configure the frontend to use your server URL (e.g. http://localhost:8080) for API calls.

Production frontend

Build the frontend and point the server at the build output:

cd frontend
bun run build

Set STATIC_DIR in .env to the path of the built static files (e.g. frontend/build or the equivalent output directory). The server will serve the SPA from that path.

CLI

Build the CLI (requires a CLI entrypoint in the repo; if you use the API only, you can skip this):

make build-cli
./bin/trelay config set api-url http://localhost:8080
./bin/trelay config set api-key YOUR_API_KEY
./bin/trelay create https://example.com --slug my-link
./bin/trelay list

See CLI Reference for all commands.

Health check

Verify the server is running:

curl http://localhost:8080/healthz

Expected response: {"status":"ok"}