Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
N

nostr-rs-relay

> 编程语言
Open source

Mirror of https://sr.ht/~gheartsfield/nostr-rs-relay/

711 stars0 likes1 views
WebsiteGitHub

About

Mirror of https://sr.ht/~gheartsfield/nostr-rs-relay/

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.

Features

NIPs with a relay-specific implementation are listed here.

  • NIP-01: Basic protocol flow description
    • Core event model
    • Hide old metadata events
    • Id/Author prefix search
  • NIP-02: Contact List and Petnames
  • NIP-03: OpenTimestamps Attestations for Events
  • NIP-05: Mapping Nostr keys to DNS-based internet identifiers
  • NIP-09: Event Deletion
  • NIP-11: Relay Information Document
  • NIP-12: Generic Tag Queries
  • NIP-15: End of Stored Events Notice
  • NIP-16: Event Treatment
  • NIP-20: Command Results
  • NIP-22: Event created_at limits (future-dated events only)
  • NIP-26: Event Delegation (implemented, but currently disabled)
  • NIP-28: Public Chat
  • NIP-33: Parameterized Replaceable Events
  • NIP-40: Expiration Timestamp
  • NIP-42: Authentication of clients to relays
  • NIP-91: AND operator for filters

Quick Start

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.

bash
$ 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 world

A pre-built container is also available on DockerHub: https://hub.docker.com/r/scsibug/nostr-rs-relay

Build and Run (without Docker)

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:

bash
$ sudo apt-get install build-essential cmake protobuf-compiler pkg-config libssl-dev

On OpenBSD:

bash
$ doas pkg_add rust protobuf

Clone this repository, and then build a release version of the relay:

bash
$ git clone -q https://git.sr.ht/\~gheartsfield/nostr-rs-relay
$ cd nostr-rs-relay
$ cargo build -q -r

The 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.

Configuration

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:

bash
$ 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-relay

Options include rate-limiting, event size limits, and network address settings.

Reverse Proxy Configuration

For examples of putting the relay behind a reverse proxy (for TLS termination, load balancing, and other features), see Reverse Proxy.

Dev Channel

For development discussions, please feel free to use the sourcehut mailing list.

License

This project is MIT licensed.

External Documentation and Links

  • BlockChainCaffe's Nostr Relay Setup Guide

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rustnostrrust

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言