relay-ttydocs
Reference

Environment Variables

Configure relay-tty via environment variables or a .env file in the project root.

VariableRequiredDescription
JWT_SECRETYes (for remote)Secret for signing auth JWTs. Generate with openssl rand -base64 32
PORTNoServer port (default: 7680)
APP_URLNoPublic URL for remote access (e.g., https://relay.example.com). Shown on startup and used for Discord notifications
DISCORD_WEBHOOKNoDiscord webhook URL. Posts a clickable auth link on startup
RELAY_SKIP_BINARY_DOWNLOADNoSet to 1 to skip downloading the pre-built Rust binary during npm install

Session environment

These variables are set automatically inside every relay session. They are available to the child process and can be used by scripts or tools like relay info.

VariableDescription
RELAY_SESSION_IDThe 8-character hex session ID
RELAY_ORIG_COMMANDThe command that was passed to relay
RELAY_ORIG_ARGSJSON array of the original command arguments

Example .env

JWT_SECRET='your-secret-here'
PORT=18701
APP_URL='https://abc123.relaytty.com'
DISCORD_WEBHOOK='https://discord.com/api/webhooks/...'

Auth token

When JWT_SECRET is set, the server prints an auth token URL on startup:

Auth token URL: http://localhost:18701/api/auth/callback?token=eyJ...

Visit this URL in a browser to set a session cookie (30-day expiry). The token itself does not expire — rotate JWT_SECRET to revoke all tokens.

Localhost connections always bypass authentication.

On this page