Skip to main content

Relay Configuration

The settings you are most likely to change for strfry, nostr-rs-relay and nostream. Every key and default below is copied from the project's own sample config as of October 2026: strfry.conf, nostr-rs-relay config.toml, and nostream default-settings.yaml plus CONFIGURATION.md. Keys change between releases, so check the sample that ships with your version.

strfry​

strfry reads the first config it finds: the --config option, then $STRFRY_CONFIG, then /etc/strfry.conf, then ./strfry.conf. The file uses taocpp config syntax, not YAML or TOML. Only db is required; everything else has a default. Many keys reload without a restart; the sample marks the ones that need one with "(restart required)".

Keys in this table are written with dots for nesting: relay.info.name is name inside info { } inside relay { }.

KeyDefaultWhat it does
db"./strfry-db/"LMDB directory.
relay.bind"127.0.0.1"Listen address. Use 0.0.0.0 only without a local proxy, or in a container.
relay.port7777WebSocket port.
relay.realIpHeader""Header holding the client IP behind a proxy, e.g. "x-real-ip". Must be lower case.
relay.nofiles524288Open-file limit to request from the OS (0 = don't set).
relay.info.name, description, pubkey, contact, icon, banner, privacy, termsNIP-11 fields. relay.info.self is the relay's own pubkey.
relay.auth.enabledtrueNIP-42 AUTH.
relay.auth.serviceUrl""Your public wss:// URL. Needed to validate AUTH responses.
relay.auth.restrictedReadKinds"4, 1059"Kinds that need AUTH to read (DMs and gift wraps).
relay.maxWebsocketPayloadSize131072Largest incoming frame, bytes.
relay.maxReqFilterSize200Filters allowed in one REQ.
relay.maxSubsPerConnection200Open subscriptions per connection.
relay.maxFilterLimit500Most events returned per filter.
relay.autoPingSeconds55WebSocket ping interval. Keep it below your proxy's idle timeout.
relay.writePolicy.plugin""Path to a write-policy plugin (below).
relay.negentropy.enabledtrueNIP-77 sync.
relay.filterValidation.*enabled = falseOptional stricter REQ rules: filters per REQ, kinds per filter, allowed kinds, require an author or tag.
events.maxEventSize65536Largest event (normalised JSON), bytes.
events.rejectEventsNewerThanSeconds900Reject events dated more than 15 minutes ahead.
events.rejectEventsOlderThanSeconds94608000Reject events older than 3 years.
events.maxNumTags2000Tags per event.
events.maxTagValSize1024Bytes per tag value.

This is how the NIP-11 and network parts look in the sample file (comments shortened):

relay {
bind = "127.0.0.1"
port = 7777
realIpHeader = ""

auth {
enabled = true
serviceUrl = ""
}

info {
name = "strfry default"
description = "This is a strfry instance."
pubkey = ""
contact = ""
}
}

The sample also has dbParams, relay.compression, relay.logging and relay.numThreads blocks. Leave them alone unless you are tuning a busy relay.

Write-policy plugins​

strfry keeps policy (allowlists, rate limits, spam rules) out of the core. A plugin is a long-running program: strfry writes one JSON object per line to its stdin and reads one JSON line back for each. Don't read stdin to the end; handle it line by line.

Each input line has type (always "new"), event, receivedAt, sourceType (IP4, IP6, Import, Stream, Sync or Stored), sourceInfo (usually the IP) and, after NIP-42 AUTH, authed (the pubkey). The reply must contain the event's id, an action (accept, reject or shadowReject) and, for reject, a msg sent to the client. Details: docs/plugins.md.

The allowlist example from the strfry docs, whitelist.js:

#!/usr/bin/env node

const whiteList = {
'003ba9b2c5bd8afeed41a4ce362a8b7fc3ab59c25b6a1359cae9093f296dac01': true,
};

const rl = require('readline').createInterface({
input: process.stdin,
output: process.stdout,
terminal: false
});

rl.on('line', (line) => {
let req = JSON.parse(line);

if (req.type !== 'new') {
console.error("unexpected request type"); // will appear in strfry logs
return;
}

let res = { id: req.event.id }; // must echo the event's id

if (whiteList[req.event.pubkey]) {
res.action = 'accept';
} else {
res.action = 'reject';
res.msg = 'blocked: not on white-list';
}

console.log(JSON.stringify(res));
});

A kind allowlist in Python. Output must be one minified JSON line per event, flushed:

#!/usr/bin/env python3
import json, sys

ALLOWED_KINDS = {0, 1, 3, 5, 7, 10002}

for line in sys.stdin:
req = json.loads(line)
if req.get("type") != "new":
print("unexpected request type", file=sys.stderr)
continue
event = req["event"]
res = {"id": event["id"]}
if event["kind"] in ALLOWED_KINDS:
res["action"] = "accept"
else:
res["action"] = "reject"
res["msg"] = f"blocked: kind {event['kind']} not allowed"
print(json.dumps(res, separators=(",", ":")), flush=True)

Install either one with chmod a+x and set relay.writePolicy.plugin to its path. strfry reloads the plugin when the file changes.

Tested by piping strfry-format input lines into both scripts, including a stdin that stays open (both answer each line at once):

echo '{"type":"new","event":{"id":"bb","pubkey":"ff","kind":4},"receivedAt":1,"sourceType":"IP4","sourceInfo":"1.2.3.4"}' \
| ./kinds.py
# {"id":"bb","action":"reject","msg":"blocked: kind 4 not allowed"}

If clients see error: internal error, the plugin crashed or printed something strfry couldn't parse. Check the strfry log.

nostr-rs-relay​

Settings live in config.toml in the working directory (in Docker, /usr/src/app/config.toml). Most keys are commented out in the sample, which means the default applies.

SectionKeyDefaultWhat it does
[info]relay_url, name, description, pubkey, contact, relay_iconNIP-11 fields. pubkey is 32-byte hex, not npub.
[database]engine"sqlite"sqlite or postgres (Postgres support is marked experimental).
[database]data_directory"."Where nostr.db lives. Also --db dirname.
[database]connectionPostgres connection string.
[network]address, port"0.0.0.0", 8080Listen address. Set 127.0.0.1 behind a proxy.
[network]remote_ip_header"x-forwarded-for", or "cf-connecting-ip" behind Cloudflare.
[network]ping_interval300WebSocket ping, seconds.
[options]reject_future_seconds1800Reject events dated this far ahead.
[limits]messages_per_secunlimitedEvents per second for the whole server. Set it on a public relay.
[limits]subscriptions_per_minunlimitedPer client. The sample suggests about 10.
[limits]max_event_bytes, max_ws_message_bytes, max_ws_frame_bytes131072Size limits.
[limits]event_kind_blacklist, event_kind_allowlistDrop or allow by kind.
[limits]limit_scrapersfalseReject broad queries (kind-only, author-only).
[authorization]pubkey_whitelistOnly these pubkeys may publish.
[authorization]nip42_auth, nip42_dmsfalseNIP-42 AUTH; send DMs (kinds 4, 44) and gift wraps (1059) only to their authenticated recipients.
[verified_users]mode"disabled"NIP-05 gating: enabled, passive or disabled.
[verified_users]verify_expiration, verify_update_frequency"1 week", "24 hours"How long a NIP-05 check is valid, and how often to recheck.
[grpc]event_admission_serverExternal service that accepts or rejects each event (proto/nauthz.proto).
[pay_to_relay]enabled, processor, admission_cost, node_urlfalsePaid admission through LNbits or Core Lightning (ClnRest).

The [network] part for a relay behind a local proxy:

[network]
address = "127.0.0.1"
port = 8080
remote_ip_header = "x-forwarded-for"

nostream​

nostream has two places for settings:

  • .env for secrets and connections. Only SECRET is required; .env.example lists the rest: DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD (or DB_URI), REDIS_HOST, REDIS_PORT (or REDIS_URI), RELAY_PORT (default 8008), WORKER_COUNT, and NOSTR_CONFIG_DIR. The default database name and user are both nostr_ts_relay.
  • .nostr/settings.yaml for relay policy. The first run copies it from resources/default-settings.yaml. Changes are picked up without a restart.
KeyDefaultWhat it does
info.relay_url, name, description, pubkey, contact, terms_of_serviceplaceholdersNIP-11 fields. Replace them.
network.remoteIpHeadercommented outx-forwarded-for or cf-connecting-ip. Only honoured from network.trustedProxies.
network.trustedProxiesloopback and 10.10.10.1Proxies allowed to set that header.
network.maxPayloadSize524288Largest message, bytes.
payments.enabled, payments.processorfalse, zebedeeAdmission fees. Processors are configured under paymentsProcessors (zebedee, lnbits, lnurl, nodeless, opennode, nwc).
payments.feeSchedules.admission[]disabled, 1,000,000 msatsFee per pubkey, with pubkey and kind whitelists.
nip05.modedisabledenabled, passive or disabled.
nip42.authRequiredfalseRequire AUTH as the author before publishing.
nip42.restrictedReadsdisabled, kinds 4 and 1059Deliver these kinds only to their authenticated author or recipient.
nip43.enabledfalseInvite-based membership. Blocks non-members from publishing.
nip50.enabledfalseFull-text search.
nip77.enabledfalseNegentropy sync (Postgres backend only).
wot.enabled, wot.seedPubkeyfalseWeb-of-trust graph from kind 3 lists.
limits.event.kind.whitelist / blacklist[]Allow or block kinds.
limits.event.pubkey.whitelist / blacklist[]Allow or block pubkeys.
limits.event.createdAt.maxPositiveDelta900Seconds into the future.
limits.event.rateLimits[]per-kind rulesEvents per period, by kind range.
limits.event.retention.maxDays-1 (keep)Delete events older than this.
limits.client.subscription.maxSubscriptions, maxFilters, maxLimit10, 10, 5000Per-client query limits.
mirroring.static[][]Relays to mirror from. See Sync Tools.
admin.enabledfalseWeb admin console (needs ADMIN_PASSWORD in .env).

The full list with explanations is in CONFIGURATION.md.

Settings every public relay should get right​

Concernstrfrynostr-rs-relaynostream
Real client IP behind a proxyrelay.realIpHeadernetwork.remote_ip_headernetwork.remoteIpHeader + trustedProxies
NIP-11 identityrelay.info.*[info]info.*
NIP-42 AUTHrelay.auth.enabled + serviceUrlauthorization.nip42_authnip42.*
Who may writewrite-policy pluginpubkey_whitelist, gRPC, pay-to-relaylimits.event.pubkey.*, payments, NIP-43
Which kindsplugin, filterValidation.allowedKinds (reads)event_kind_allowlistlimits.event.kind.*

Checking your NIP-11 output after a change: curl -H 'Accept: application/nostr+json' https://relay.example.com. The fields are described on Relay Information.