Prerequisites
- Docker (any recent version with Compose v2 —
docker compose, notdocker-compose) opensslavailable on your PATH (ships with macOS and most Linux distributions)- A domain or tunnel to expose the relay to teammates on other laptops
Setup
1
Clone the repo and copy the environment file
.env file is read automatically by docker compose. All relay configuration — database credentials, secrets, public URL — lives here.2
Rotate the secrets
The example file ships with stable dev-only placeholders. Replace every secret with a freshly generated random value before exposing the relay outside localhost.On Linux, drop the Stash the resulting
'' after -i:RELAY_ADMIN_TOKEN value somewhere secure (see Share the admin token below) — your teammates need it to register.3
Start the relay
The relay waits for Postgres to pass its health check, then runs Drizzle migrations on boot (idempotent — safe to re-run). Both containers restart
unless-stopped, so they survive host reboots.4
Verify the relay is healthy
Expose to the internet
Teammates on other laptops need to reach the relay over HTTPS. Point a reverse proxy at port8080 on the host running Docker, then set RELAY_PUBLIC_URL in .env to the public URL and restart:
- nginx
- Caddy
- Cloudflare Tunnel
Share the admin token
RELAY_ADMIN_TOKEN is what each teammate passes to agentrelay register to create their identity on the relay. Treat it like a password.
- Store it in 1Password, your team’s password manager, or another secrets vault.
- DM it to each teammate over a secure channel (not Slack public channels or email).
- Do not commit
.envto version control.
Recommended hosting
For teams that prefer not to manage their own Linux box, any container-capable PaaS works. The relay is a single stateless container; Postgres can be the managed database your host offers.Fly.io
256 MB shared-cpu VM + Fly Postgres. Approximately $5–10/month for a small team. Good free tier for testing.
Render
Web Service + managed Postgres. Approximately $7–15/month. Simple deploy from a Docker image.
Railway
Docker deploy + Railway Postgres. Approximately $5–12/month depending on usage. Good developer experience.
Self-hosted VPS
Any VPS (DigitalOcean, Hetzner, Linode) with Docker installed. Full control, lowest cost at scale.
For a small engineering team (under 50 developers, under 10k handoffs per day), the smallest paid tier on any of these platforms is sufficient. The relay’s resource ceiling in v0.1 is the notification dispatcher’s webhook throughput, not compute or memory.
What’s running
After a successfuldocker compose --profile selfhost up -d, two containers are active:
agentrelay-postgres— Postgres 16 on host port5433. Data is persisted in thepostgres-dataDocker volume. Credentials are set byPOSTGRES_PASSWORDin.env.agentrelay-relay— The Hono relay service on host port8080. Built fromrelay/Dockerfile(multi-stage: pnpm build in the builder stage, slim runtime image). Connects to Postgres over the internal Docker network.
restart: unless-stopped, so they come back automatically after a host reboot or a Docker daemon restart.