/denostr

💪🏻 Deno-based, cloud-native Nostr relay forked from nostream. Sponsored by ByteTrade and Revo.

Primary LanguageTypeScriptMIT LicenseMIT

Denostr

denostr logo

GitHub release GitHub issues GitHub stars GitHub top language GitHub forks GitHub license Coverage Status Build status

💪🏻 Deno-based, cloud-native Nostr relay forked from nostream. Sponsored by ByteTrade and Revo.

This is a nostr relay, written in Typescript.

This implementation is production-ready. See below for supported features.

The project main repository is available on GitHub.

Features

NIPs with a relay-specific implementation are listed here.

  • NIP-01: Basic protocol flow description
  • NIP-02: Contact list and petnames
  • NIP-04: Encrypted Direct Message
  • NIP-09: Event deletion
  • NIP-11: Relay information document
  • NIP-11a: Relay Information Document Extensions
  • NIP-12: Generic tag queries
  • NIP-13: Proof of Work
  • NIP-15: End of Stored Events Notice
  • NIP-16: Event Treatment
  • NIP-20: Command Results
  • NIP-22: Event created_at Limits
  • NIP-26: Delegated Event Signing
  • NIP-28: Public Chat
  • NIP-33: Parameterized Replaceable Events
  • NIP-38: Encrypted Group Chat with Megolm group ratchet (Draft)
  • NIP-40: Expiration Timestamp

Architecture

Todo

Requirements

  • Deno v1.30.x or v1.31.x
  • Typescript
  • MongoDB 4.4, 5.0, 6.0
  • Redis (Optional)

kubernetes setups

  • v1.18.8 or later

Full Guide

Quick Start (Standalone)

Clone repository and enter directory:

git clone https://github.com/Guakamoli/denostr.git --depth 1 && cd denostr

Create .env file inside denostr project folder

Set the following environment variables:

WORKER_TYPE=worker
MONGO_URI=mongodb://user:pass@host:port/db?replicaSet=rs0&authSource=admin

Create .nostr folder inside denostr project folder and copy over the settings file:

mkdir .nostr
cp resources/default-settings.yaml .nostr/settings.yaml

To start in development mode:

deno task dev

Or, start in production mode:

deno task start

Apply for kubernetes

Please refer to this document

Tests

Unit tests

Run unit tests with:

deno task test:unit

Integration tests

Run integration tests with:

deno task test:integration

Configuration

You can change the default folder by setting the NOSTR_CONFIG_DIR environment variable to a different path.

Run denostr using one of the quick-start guides at least once and denostr/.nostr/settings.json will be created. Any changes made to the settings file will be read on the next start.

Default settings can be found under resources/default-settings.yaml. Feel free to copy it to denostr/.nostr/settings.yaml if you would like to have a settings file before running the relay first.

See CONFIGURATION.md for a detailed explanation of each environment variable and setting.

Dev Channel

For development discussions, please use the Nostr Typescript Relay Dev Group.

For discussions about the protocol, please feel free to use the Nostr Telegram Group.

License

This project is MIT licensed.