Nostr relay: add size limits (and optional write auth and persistence), in line with strfry and others · Issue #648 · JavaScriptSolidServer/JavaScriptSolidServer · GitHub
The built-in Nostr relay (--nostr) has no size limits of its own. It's barely used beyond one pod so far, so this isn't urgent, but it's worth matching what other relays do before anyone leans on it.
src/server.js:417 registers @fastify/websocket with no options, so ws uses its default maxPayload of 100 MB per message.
src/nostr/relay.js checks no event size, keeps up to 1,000 events in memory only (DEFAULT_MAX_EVENTS, lost on restart), allows anyone to write, and rate-limits to 60 events per minute per connection.
So a client can send very large events, and a handful of them can use a lot of memory.
What other relays default to
Relay
Max event
Max websocket message
Other defaults
strfry
64 KB (maxEventSize)
128 KB (maxWebsocketPayloadSize)
≤ 2,000 tags, tag values ≤ 1 KB, created_at window (15 min ahead, 3 years back), write-policy plugin, LMDB on disk
Activity