Mirror of https://sr.ht/~gheartsfield/nostr-rs-relay/
Mirror of https://sr.ht/~gheartsfield/nostr-rs-relay/
This is a nostr relay, written in Rust. It currently supports the entire relay protocol, and persists data with SQLite. There is experimental support for Postgresql.
The project master repository is available on sourcehut, and is mirrored on GitHub.
NIPs with a relay-specific implementation are listed here.
created_at limits (future-dated events only)The provided Dockerfile will compile and build the server
application. Use a bind mount to store the SQLite database outside of
the container image, and map the container's 8080 port to a host port
(7000 in the example below).
The examples below start a rootless podman container, mapping a local data directory and config file.
…Use a nostr client such as
noscl to publish and query
events.
$ noscl publish "hello world"
Sent to 'ws://localhost:8090'.
Seen it on 'ws://localhost:8090'.
$ noscl home
Text Note [81cf...2652] from 296a...9b92 5 seconds ago
hello worldA pre-built container is also available on DockerHub: https://hub.docker.com/r/scsibug/nostr-rs-relay
Building nostr-rs-relay requires an installation of Cargo & Rust: https://www.rust-lang.org/tools/install
The following OS packages will be helpful; on Debian/Ubuntu:
$ sudo apt-get install build-essential cmake protobuf-compiler pkg-config libssl-devOn OpenBSD:
$ doas pkg_add rust protobufClone this repository, and then build a release version of the relay:
$ git clone -q https://git.sr.ht/\~gheartsfield/nostr-rs-relay
$ cd nostr-rs-relay
$ cargo build -q -rThe relay executable is now located in
target/release/nostr-rs-relay. In order to run it with logging
enabled, execute it with the RUST_LOG variable set:
…You now have a running relay, on port 8080. Use a nostr client or
websocat to connect and send/query for events.
The sample config.toml file demonstrates the
configuration available to the relay. This file is optional, but may
be mounted into a docker container like so:
$ docker run -it -p 7000:8080 \
--mount src=$(pwd)/config.toml,target=/usr/src/app/config.toml,type=bind \
--mount src=$(pwd)/data,target=/usr/src/app/db,type=bind \
--mount src=$(pwd)/index.html,target=/usr/src/app/index.html,type=bind \
nostr-rs-relayOptions include rate-limiting, event size limits, and network address settings.
For examples of putting the relay behind a reverse proxy (for TLS termination, load balancing, and other features), see Reverse Proxy.
For development discussions, please feel free to use the sourcehut mailing list.
This project is MIT licensed.
No open issues yet, or sync has not completed.