Your own relay is coming. Reserve yours, no payment

How to run a Nostr relay

A relay is a server that has to stay online, updated, backed up and free of spam for as long as people post to it. You can have one hosted for you, or run it yourself on a small Linux server with a domain, relay software and a reverse proxy for wss://. This guide covers what either way involves, then the full self-host setup with nostr-rs-relay, Docker and Caddy.

By · Last updated

What running a relay involves

Starting a relay takes an afternoon. Keeping it is the real job, because the people who post to it count on it being there next year:

  • Uptime. Apps send your notes to the relays in your list and read them back from there. When your relay is down, those notes don't load from it, and some apps give up on a relay that keeps failing. Someone has to notice when it stops answering, day or night. Of the 1,429 public relays on our monitor, 1,277 answered its last check.
  • Updates. The relay software, the operating system, Docker images and the TLS certificate all need updating. Relay programs ship new versions every few months, and an old one can fall behind on NIPs that apps start to expect.
  • Moderation. A relay that accepts anyone's events receives spam and, sooner or later, content you don't want to host. You are the operator of what it serves. Limit who may post (a whitelist, a fee, NIP-05 checks, rate limits) and handle reports (NIP-56).
  • Backups. If the disk dies and there's no copy elsewhere, every note on it is gone from that relay. A relay without backups is a cache, not an archive.
  • Cost. A small virtual server and a domain, plus your time for all of the above. Storage grows with every note and file you keep.

The easy way: a relay hosted by us

If you want a relay of your own for your notes and would rather not look after a server, we're opening hosted relays at anchorman. Each one is your own relay, private by default, with your old notes copied in from the relays you've used, nightly backups, one-click export and a watch on it around the clock, and your name can be on your own domain.

Hosted relays aren't open yet. Reserving one is free and commits you to nothing: you're on the first list, and we write to you with the date and the price before anyone else. The pricing page lists $12 a month, or $120 a year, and nothing is charged until you decide. Your key stays with you either way, and you can add other relays next to ours or leave at any time.

Run it yourself

If you'd rather run your own server, here is a setup that works: nostr-rs-relay with Docker Compose, behind Caddy for TLS.

Tested on 4 November 2026 with nostr-rs-relay 0.10.0: the compose file's relay service and the NIP-11 check below.

Before you start

  • A server. Any small Linux VPS will do for a personal or small relay. For scale, strfry's own deployment guide uses 1 vCPU, 2 GB of RAM and a 50 GB SSD.
  • A domain with an A (and AAAA) record pointing at the server, like relay.example.com.
  • Docker with the Compose plugin, and ports 80 and 443 open. Caddy needs both to get a certificate.
  • Your public key in hex for the relay's contact field. Paste your npub into the key converter to get it.

Pick the software

The relay software comparison counts what public relays run, live. In short: nostr-rs-relay for a small relay with Docker (used here), strfry for a busy public one, HAVEN for your own personal relay and backup, and pyramid for a community that grows by invitation.

1. Make a folder and get the config

The relay reads config.toml. Start from the sample in its repository, which documents every option:

Terminal
mkdir -p ~/relay/data && cd ~/relay
curl -o config.toml https://raw.githubusercontent.com/scsibug/nostr-rs-relay/master/config.toml
sudo chown 100:100 data

2. Describe your relay

Edit the [info] section. Apps show these fields, and they become your relay's NIP-11 document. relay_url must be the public wss:// address.

config.toml
[info]
relay_url = "wss://relay.example.com/"
name = "My relay"
description = "A small relay for me and my friends."
# Your public key in hex (convert an npub on anchorman.lol/learn/keys)
pubkey = "<your hex public key>"
contact = "mailto:you@example.com"

3. Add the compose file and the Caddyfile

Caddy terminates TLS with a free certificate and passes WebSocket connections through without extra settings. The relay itself is only reachable through Caddy.

compose.yaml
services:
  relay:
    image: scsibug/nostr-rs-relay:latest
    restart: unless-stopped
    user: "100:100"
    volumes:
      - ./config.toml:/usr/src/app/config.toml:ro
      - ./data:/usr/src/app/db
  caddy:
    image: caddy:2
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro
      - caddy_data:/data
volumes:
  caddy_data:
Caddyfile
relay.example.com {
	reverse_proxy relay:8080
}

4. Start it

Terminal
docker compose up -d
docker compose logs -f relay

5. Check it

Ask for the relay's information document (NIP-11). You should get JSON back with your name, the NIPs it supports, and "software":"https://git.sr.ht/~gheartsfield/nostr-rs-relay":

Terminal
curl -H "Accept: application/nostr+json" https://relay.example.com

Then add wss://relay.example.com in your app's relay settings and post something. If the note shows up when you reload with only that relay on, it's working.

Make it yours only

A public relay accepts anyone's events, including spam. To keep it for yourself, list the keys that may post under [authorization], and restart:

config.toml
[authorization]
pubkey_whitelist = ["<your hex public key>"]

The same file has rate limits, NIP-05 checks for posters, and pay-to-relay (an admission fee in sats). The sample config explains each.

Back it up

Everything is in a SQLite database in data/. Stop the relay before copying the files, or use SQLite's own backup command, and keep the copy somewhere other than the server. Test a restore once, so you know the copy works.

Keep it running

Pull new images and restart now and then (docker compose pull && docker compose up -d), keep the server's own packages updated, and watch the disk as the database grows.

Put the relay in your own relay list (NIP-65; most apps write it when you change relay settings). Our monitor reads people's relay lists and other monitors' NIP-66 reports, so a relay that people use shows up on the relay list by itself, with an hourly check of its uptime and speed. Then set up an alert so you hear when it goes down before your followers do.

When it doesn't work

  • Caddy can't get a certificate: the DNS record doesn't point at the server yet, or port 80 is closed.
  • curl returns HTML or nothing: check the Accept: application/nostr+json header; without it you get the relay's web page.
  • Apps can't connect: a proxy that doesn't pass the WebSocket upgrade. Caddy does by default; nginx needs proxy_http_version 1.1 and the Upgrade and Connection headers.
  • The relay exits at start: docker compose logs relay. Usually data/ isn't writable by user 100, or config.toml has a typo.

Other ways to run one yourself

strfry, for a big public relay

strfry is built from source (a C++20 compiler and a few libraries) and listens on localhost:7777. Its deployment guide puts it behind nginx with certbot. The commands are on the strfry page.

HAVEN, for your own notes

HAVEN is one binary with four relays for one person (private, chat, inbox and outbox), media hosting, and backups to S3-compatible storage. Download a release, fill in .env, put Caddy in front of port 3355. See the HAVEN page.

pyramid, for a community

pyramid's installer downloads the latest release for your CPU (amd64 or arm64), installs a systemd service, and gets its own certificate, so there is no proxy to set up. You finish in the browser. See the pyramid page.

Umbrel

Umbrel's app store has an official "Nostr Relay" app, built on nostr-rs-relay. It's a private relay on your home server: Umbrel's page suggests Tailscale to reach it from outside your network.

Raspberry Pi

A Pi 4 or 5 runs 64-bit Linux, so the arm64 builds apply: pyramid's installer picks them automatically, and the others build from source. Use an SSD rather than an SD card for the database, and remember a home connection and power cut take the relay down with them.

On your laptop or phone

nostr-relay-tray runs a relay on macOS, Windows or Linux with no configuration. Citrine does the same on Android, for apps on the same phone. Both are a good personal copy of your notes, but they sleep when your device does, so they don't replace a relay other people can reach.