strtr
v0.1.2
Published
Minimal Nostr relay implementation, for daily Nostr development.
Downloads
2
Readme
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_
- Uppercased option names, prefixed with
- Passing
RelayOptions
tolaunchRelay()
| Name | Short Name| Default | Description |
| -- | -- | -- | -- |
| host
| h
| 127.0.0.1
| Host to listen on |
| port
| p
| 5454
| Port 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
- [x] NIP-01: Basic Protocol Flow
- [x] NIP-09: Event Deletion