# Self-host Relay from source

Canonical HTML: https://anchorshell.com/guides/self-host-bouncer/

Clone the public Relay repository, start the embedded application, and protect its first-run secrets.

Last updated: 2026-08-18

## Purpose

Run AnchorShell Relay from the public source repository. This procedure starts the Go service and its embedded admin interface.

## Prerequisites

Install these tools before you continue:

| Tool | Required version | Use |
| --- | --- | --- |
| Go | `1.26.4` | Build and run Relay |
| Node.js | `22.19.0` | Build the Nuxt interface |
| Git | Current supported release | Clone the repository |
| Make | Current supported release | Run the supported workflow |

## Start Relay

1. Clone the public repository.

```sh
git clone https://github.com/anchorshell/relay.git anchorshell-relay
```

2. Enter the repository.

```sh
cd anchorshell-relay
```

3. Install the Go and frontend dependencies.

```sh
make deps
```

4. Start the production-style application.

```sh
make run
```

5. Save the generated `RELAY_ADMIN_TOKEN`, `RELAY_API_TOKEN`, and `RELAY_MASTER_KEY`. Relay prints generated values once and writes them to a mode-`0600` `.env` file.

> **Warning:** Keep `RELAY_MASTER_KEY` outside your database backup. You cannot recover existing encrypted provider credentials if you lose this key.

6. Open `http://localhost:11730/`.

7. Enter `RELAY_ADMIN_TOKEN` when the interface asks you to unlock administration.

## Expected result

The Dashboard opens. Relay serves the admin interface and the OpenAI-compatible gateway from port `11730`.

The management token protects the dashboard and management API. Inference separately requires `RELAY_API_TOKEN`. An explicitly empty `RELAY_API_TOKEN=` disables inference authentication; use that only in a controlled environment. Keep HTTPS and network access controls for remote deployments.

## Verification

Open `http://localhost:11730/` and confirm that the admin unlock screen loads. After configuration, send a request and confirm it appears in **Logs**.

## Use hot reload

Install the development watcher once.

```sh
make install-dev-tools
```

Start the Go and Nuxt development servers.

```sh
make dev
```

Open `http://127.0.0.1:3030` for frontend work. The backend and API remain at `http://127.0.0.1:11730`.

## Recovery

- If port `11730` is busy, stop the conflicting process or set an explicit backend address.
- If Node has the wrong version, run `nvm use 22.19.0` and repeat `make deps`.
- If Relay rejects the master key, restore the exact key that encrypted the stored provider credentials.
- If the UI build is stale, run the supported `make run` workflow again. It rebuilds and embeds the Nuxt output.

## Next

[Send a request through the dummy model](https://anchorshell.com/guides/dummy-model-first-request).
