Skip to content

Development

Building Relay requires Node.js 24 or newer and Go 1.26.6 or newer, as declared by package.json and go.mod at b67fdde3.

git clone https://git.thc420.dev/ouch/relay.git
cd relay
npm ci
npm run build:client
go build -o relay ./cmd/relay
RELAY_DEV_HOME="$(mktemp -d /tmp/relay-dev.XXXXXX)"
RELAY_HOME="$RELAY_DEV_HOME" ./relay start -c host=127.0.0.1

Run from the repository root: the server serves the generated public/ directory, which is not embedded in the Go binary. Build the client before opening Relay; deploy public/ alongside the binary with the expected working directory. Current master's npm run build:client checks generated Prism loaders and builds both the main client and paste viewer; it does not regenerate tracked source.

The running server does not require Node.js. relay migrate-config needs Node and the dumper script to evaluate legacy config.js, unless given a pre-generated --dump.

Development loop

After the initial npm ci and npm run build:client, run these from the repository root in separate terminals. Use a temporary RELAY_HOME for the server to avoid connecting existing accounts:

npm run watch
RELAY_DEV_HOME="$(mktemp -d /tmp/relay-dev.XXXXXX)"
RELAY_HOME="$RELAY_DEV_HOME" go run ./cmd/relay start --dev -c host=127.0.0.1

The --dev flag relaxes the content security policy for local client builds. Restart the Go process after server-side changes.

For an isolated instance:

RELAY_DEV_HOME="$(mktemp -d /tmp/relay-dev.XXXXXX)"
npm run build:client
RELAY_HOME="$RELAY_DEV_HOME" go run ./cmd/relay start --dev -c host=127.0.0.1

Checks

On current master, follow the upstream contribution guide:

  • sh scripts/verify.sh frontend checks generated source, lint, types, coverage, and production clients.
  • sh scripts/verify.sh backend runs application Go build, tests, and vet; PostgreSQL tests skip visibly without a test DSN.
  • Add sh scripts/verify.sh storage for storage/provider changes.
  • sh scripts/verify.sh full requires a dedicated disposable PostgreSQL database configured through RELAY_TEST_POSTGRES_DSN.

Use npm test for focused iteration (lint, types, and Vitest, without coverage). Do not use bare Go ./..., which can include unrelated npm dependency packages. Do not run database tests against production data. Older release branches may use different commands; follow their branch-local contribution instructions.

Report vulnerabilities using the private channels on Security reporting.

Audit execution results and environment limits are recorded in the documentation audit.