Relayloft docsSign in

Install with one command

API base URL: https://api.relayloft.com

Run this in your app's folder and follow the prompts. It connects your sending domain, creates a key and puts it where your app reads its secrets, then sends a test email. Node 18 or newer; nothing to install first.

npx relayloft init

What it does, step by step

  1. Signs in through your browser. It shows a code like ABCD-EFGH and opens /device in the portal. An Owner or Admin types that code there and approves it (see below). No password or key is ever typed into the terminal for this.
  2. Looks at your project: a Cloudflare Worker or Pages project, a Vercel project, or a plain .env file; whether you use the Resend SDK or call the API with fetch; and the From address you send with.
  3. Connects your sending domain to the app you picked, with the same rules and limits as the portal's Domains page, and shows the DNS records to publish. If the domain is on Cloudflare, it can add them for you with a Cloudflare API token you type into a hidden prompt (Zone → DNS → Edit on that zone); the token is used once and never stored. Existing records are never changed: any that clash are listed for you to fix.
  4. Waits for the domain to verify, or tells you how to finish later if DNS is slow.
  5. Creates a sending-only key limited to that one domain and pipes it straight into your host's secret store (wrangler secret put, vercel env add, or .env.local when that file is git-ignored). The key is never printed.
  6. Points your app at Relayloft. Usually nothing changes in your code: the Resend Node SDK reads RESEND_API_KEY and RESEND_BASE_URL from the environment. Where your code passes the key itself, or calls the API with fetch, it shows the one-line change as a diff and asks before saving it.
  7. Sends a test email to delivered@simulator.relayloft.com with the new key and prints the result. The test addresses work during the trial too.
  8. Signs out: the CLI session ends as soon as setup finishes.

Options: --dry-run (shows what it would do, changes nothing), --yes (accepts the defaults), --domain and --host (skip the questions).

What the person approving sees

The portal's /device page shows the address the request came from as Relayloft saw it, when it started, the program that sent it, and the device's name (labelled as reported by the device, since the device chooses it). It warns when the request came from a different network or country than theirs. It doesn't display the code (the link the CLI opens carries it, so the page can find the request): they type it from your terminal, pick the app, enter their authenticator code and press Approve, or Deny. Only an Owner or Admin can approve; a Member is asked to have their Owner or an Admin run it. The Owner is emailed every approval and every key the CLI creates, and each one is in the audit log.

Only approve a code you just started on your own computer. Nobody from Relayloft will ever ask you for one.

Security

Supported hosts

If your app already sends with Resend

A Resend key can't be read back once it's overwritten, so the CLI checks first. With no Resend key yet, it sets RESEND_API_KEY and RESEND_BASE_URL. If one exists, by default it sets new variables beside it and has the client use them, the base URL picking the key:

RELAYLOFT_API_KEY=mr_...        # sending-only, one domain
RELAYLOFT_BASE_URL=https://api.relayloft.com

new Resend(env.RELAYLOFT_BASE_URL ? env.RELAYLOFT_API_KEY : env.RESEND_API_KEY, { baseUrl: env.RELAYLOFT_BASE_URL })

You can choose to replace the Resend key instead; the CLI warns you first, because rolling back then needs a new Resend key.

Roll back

Side by side: delete RELAYLOFT_API_KEY and RELAYLOFT_BASE_URL and redeploy; your app uses the Resend key again. You can also revoke the CLI's key on the portal's API keys page. The domain and its DNS records can stay; see Switch from Resend for the rest of a move.