Skip to content

nostrdevkit/nostrd

Repository files navigation

Nostr Daemon

nostrd is a daemon for hosting and operating Nostr services. Its first service is a persistent Nostr relay backed by LMDB.

Install

cargo install nostrd

Usage

Check all commands with:

nostrd --help

Run the relay with the built-in defaults:

nostrd relay

Use a TOML configuration file:

nostrd --config /path/to/nostrd.toml relay

See nostrd.example.toml for all currently supported options. Relative database paths are resolved from the configuration file directory.

The configuration is selected in this order:

  1. --config
  2. NOSTRD_CONFIG
  3. /etc/nostrd/nostrd.toml
  4. ./nostrd.toml
  5. built-in defaults

Inspect or reindex the LMDB database while the relay is stopped:

nostrd --config nostrd.toml database stats
nostrd --config nostrd.toml database reindex

HTTP endpoints

  • / upgrades WebSocket connections and returns the NIP-11 document when requested with Accept: application/nostr+json.
  • /healthz reports process readiness.

Terminate TLS in a reverse proxy such as nginx or Caddy. The packaged configuration binds to 127.0.0.1 for this reason.

Docker

docker compose up -d

The image runs as an unprivileged user and stores LMDB data in /data. Customize packaging/docker/nostrd.toml before deploying it.

Debian

Build the package with:

cargo build --locked --release
cargo deb --no-build

The package installs /etc/nostrd/nostrd.toml and nostrd.service. Enable the service after setting its public URL and relay identity:

sudo systemctl enable --now nostrd

For an offline backup, stop the service and archive /var/lib/nostrd. Database maintenance commands should also be run while the relay is stopped.

Donations

Nostr Dev Kit is free and open-source. This means we do not earn any revenue by selling it. Instead, we rely on your financial support. If you actively use any of the libs/software/services, then please donate.

License

This project is distributed under the MIT software license — see the LICENSE file for details

About

A Nostr relay built on NostrDevKit

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages