README.md (4169B)
1 # [nostr-rs-relay](https://git.sr.ht/~gheartsfield/nostr-rs-relay) 2 3 This is a [nostr](https://github.com/nostr-protocol/nostr) relay, written in 4 Rust. It currently supports the entire relay protocol, and has a 5 SQLite persistence layer. 6 7 The project master repository is available on 8 [sourcehut](https://sr.ht/~gheartsfield/nostr-rs-relay/), and is 9 mirrored on [GitHub](https://github.com/scsibug/nostr-rs-relay). 10 11 [![builds.sr.ht status](https://builds.sr.ht/~gheartsfield/nostr-rs-relay/commits/master.svg)](https://builds.sr.ht/~gheartsfield/nostr-rs-relay/commits/master?) 12 13 ## Features 14 15 [NIPs](https://github.com/nostr-protocol/nips) with a relay-specific implementation are listed here. 16 17 - [x] NIP-01: [Basic protocol flow description](https://github.com/nostr-protocol/nips/blob/master/01.md) 18 * Core event model 19 * Hide old metadata events 20 * Id/Author prefix search 21 - [x] NIP-02: [Contact List and Petnames](https://github.com/nostr-protocol/nips/blob/master/02.md) 22 - [ ] NIP-03: [OpenTimestamps Attestations for Events](https://github.com/nostr-protocol/nips/blob/master/03.md) 23 - [x] NIP-05: [Mapping Nostr keys to DNS-based internet identifiers](https://github.com/nostr-protocol/nips/blob/master/05.md) 24 - [x] NIP-09: [Event Deletion](https://github.com/nostr-protocol/nips/blob/master/09.md) 25 - [x] NIP-11: [Relay Information Document](https://github.com/nostr-protocol/nips/blob/master/11.md) 26 - [x] NIP-12: [Generic Tag Queries](https://github.com/nostr-protocol/nips/blob/master/12.md) 27 - [x] NIP-15: [End of Stored Events Notice](https://github.com/nostr-protocol/nips/blob/master/15.md) 28 - [x] NIP-16: [Event Treatment](https://github.com/nostr-protocol/nips/blob/master/16.md) 29 - [x] NIP-22: [Event `created_at` limits](https://github.com/nostr-protocol/nips/blob/master/22.md) (_future-dated events only_) 30 - [x] NIP-26: [Event Delegation](https://github.com/nostr-protocol/nips/blob/master/26.md) 31 32 ## Quick Start 33 34 The provided `Dockerfile` will compile and build the server 35 application. Use a bind mount to store the SQLite database outside of 36 the container image, and map the container's 8080 port to a host port 37 (7000 in the example below). 38 39 ```console 40 $ docker build -t nostr-rs-relay . 41 42 $ docker run -it -p 7000:8080 \ 43 --mount src=$(pwd)/data,target=/usr/src/app/db,type=bind nostr-rs-relay 44 45 [2021-12-31T19:58:31Z INFO nostr_rs_relay] listening on: 0.0.0.0:8080 46 [2021-12-31T19:58:31Z INFO nostr_rs_relay::db] opened database "/usr/src/app/db/nostr.db" for writing 47 [2021-12-31T19:58:31Z INFO nostr_rs_relay::db] DB version = 2 48 ``` 49 50 Use a `nostr` client such as 51 [`noscl`](https://github.com/fiatjaf/noscl) to publish and query 52 events. 53 54 ```console 55 $ noscl publish "hello world" 56 Sent to 'ws://localhost:8090'. 57 Seen it on 'ws://localhost:8090'. 58 $ noscl home 59 Text Note [81cf...2652] from 296a...9b92 5 seconds ago 60 hello world 61 ``` 62 63 A pre-built container is also available on DockerHub: 64 https://hub.docker.com/r/scsibug/nostr-rs-relay 65 66 ## Configuration 67 68 The sample [`config.toml`](config.toml) file demonstrates the 69 configuration available to the relay. This file is optional, but may 70 be mounted into a docker container like so: 71 72 ```console 73 $ docker run -it -p 7000:8080 \ 74 --mount src=$(pwd)/config.toml,target=/usr/src/app/config.toml,type=bind \ 75 --mount src=$(pwd)/data,target=/usr/src/app/db,type=bind \ 76 nostr-rs-relay 77 ``` 78 79 Options include rate-limiting, event size limits, and network address 80 settings. 81 82 ## Reverse Proxy Configuration 83 84 For examples of putting the relay behind a reverse proxy (for TLS 85 termination, load balancing, and other features), see [Reverse 86 Proxy](reverse-proxy.md). 87 88 ## Dev Channel 89 90 For development discussions, please feel free to use the [sourcehut 91 mailing list](https://lists.sr.ht/~gheartsfield/nostr-rs-relay-devel). 92 Or, drop by the [Nostr Telegram Channel](https://t.me/nostr_protocol). 93 94 To chat about `nostr-rs-relay` on `nostr` itself; visit our channel on [anigma](https://anigma.io/) or another client that supports [NIP-28](https://github.com/nostr-protocol/nips/blob/master/28.md) chats: 95 * `2ad246a094fee48c6e455dd13d759d5f41b5a233120f5719d81ebc1935075194` 96 97 License 98 --- 99 This project is MIT licensed.