0.1.2 • Published 1 year ago

strtr v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

strtr

Minimal Nostr relay implementation, for daily Nostr development.

How to Use

Launch with npx:

npx strtr

Launch with a script:

import { launchRelay } from "strtr";

// launchRelay() returns a function that shutdown the relay server
const shutdown = launchRelay();

// work with the relay...

// after use, gracefully shutdown it
shutdown();

By default, the relay listen on 127.0.0.1:5454. You can change it with options.

!NOTE For now, strtr holds all events in memory and forgets them all on shutdown.

Options

You can specify relay options by:

  • Command line options
  • Environment variables
    • Uppercased option names, prefixed with STRTR_
  • Passing RelayOptions to launchRelay()
NameShort NameDefaultDescription
hosth127.0.0.1Host to listen on
portp5454Port to listen on

Example: Command Line Options

# long name
npx strtr --host 0.0.0.0 --port 9999

# short name
npx strtr -h 0.0.0.0 -p 9999

Example: Environment variables

export STRTR_HOST=0.0.0.0
export STRTR_PORT=9999
npx strtr

Example: RelayOptions

import { launchRelay, type RelayOptions } from "strtr";

// launchRelay() returns a function that shutdown the relay server
const shutdown = launchRelay({ host: "0.0.0.0", port: 9999 });

Supported NIPs

  • NIP-01: Basic Protocol Flow
  • NIP-09: Event Deletion
0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago