Installation

Requirements, building from source, installing a pre-built binary, and notes for FreeBSD.

Requirements

  • A recent stable Rust toolchain (only needed to build the relay).
  • A Linux machine.
  • 2 GB of RAM or more is recommended — see the low-spec note below for a 0.25 vCPU / 512 MB VPS.

Low-spec VPS (0.25 vCPU / 512 MB)

nostrfy is verified to run stably even when the database exceeds RAM. The LMDB map is a sparse 1 TiB virtual reservation — physical disk grows only with the data written — and process memory stays flat: a relay with a 252 MB database held 7.9 MB of private RSS (the rest is reclaimable file cache the kernel evicts under pressure).

For a tiny VPS, one setting makes the biggest difference:

toml
[database]
search_index = false   # halves the database size and saves CPU/IO
SettingEffectMeasured
search_index = falseDisables the NIP-50 word index — search still works (whole-word matching) but is slower41.8 MB → 20.5 MB per 10,000 events
DefaultsAlready tuned for low memoryNo change needed for 512 MB

Building from source

sh
git clone https://github.com/iqbqioza/nostrfy.git
cd nostrfy
cargo build --release

When the build finishes, the binary is at target/release/nostrfy.

Installing a pre-built binary

The release workflow attaches pre-built binaries for Linux x86_64, Linux aarch64 and FreeBSD x86_64. The same install.sh works on both OSes — it detects the platform, downloads the matching binary and verifies its checksum:

sh
curl -fsSL https://raw.githubusercontent.com/iqbqioza/nostrfy/main/install.sh | sh

FreeBSD

nostrfy builds and runs on FreeBSD 13.x and 14.x (amd64). Install Rust and build with:

sh
pkg install -y rust
cargo build --release

Platform notes:

  • The process-alive check used by start/stop/restart reads the process name via the kern.proc.pid.<pid>.comm sysctl on FreeBSD (it uses /proc/<pid>/comm on Linux), so a stale pid file whose pid was reused by another program is detected on both platforms.
  • nostrfy start daemonizes like on Linux; the standard double-fork daemon works with the default rc integration (service nostrfy start).
  • Blossom's min_free_bytes check uses statvfs, which both systems provide; no other platform-specific code is used (the relay itself is plain async Rust on top of tokio).

Running on port 80

Regular users cannot bind port 80. Either run with sudo, or use a higher port such as 8080.

sh
nostrfy --config nostrfy.toml start

Example: run on port 8080 (works for regular users; change port in the config first).

Next
Now that nostrfy is installed, follow the quick start guide.