Skip to content

Run your own relay

Your phone and your Mac talk end to end encrypted. On the same Wi-Fi (or with Tailscale) they talk directly. Away from it, messages pass through a relay: a small server that hands sealed messages between them. It can’t read them and it keeps nothing (how it works).

perch uses one we run, so the phone works out of the box. You can run your own instead, so nothing of yours passes through ours.

  1. Fork perch on GitHub.
  2. In Railway, New Project → Deploy from GitHub repo, and pick your fork.
  3. In the new service’s Settings, set Root Directory to relay and Config file to /relay/railway.json. That sets the start command and a health check.
  4. Settings → Networking → Generate Domain. That address is your relay, already on HTTPS.

It needs no environment variables, no database and no volume, and the smallest instance is plenty.

Any server with Node 22 or newer:

Terminal window
cd relay
npm install
npm start # listens on $PORT, default 8787

Put it behind HTTPS (a reverse proxy like Caddy does this for you).

  1. On your Mac: Settings → Phone → Relay, and paste your relay’s https:// address.
  2. Restart perch.
  3. Pair your phone again, so it learns the new address.

To go back to ours, clear the field and do the same.