Nostr Relay on a No-KYC VPS: Sizing, Spam and Metadata
Run your own Nostr relay on a no-KYC VPS: strfry vs nostr-rs-relay, real sizing, spam and abuse control, and what a relay still sees about you.
A Nostr relay is one of the lightest services you can self-host. A personal or small-group relay runs fine on a 1 vCPU, 2 GB VPS. Your bigger decisions are about who can write to it, how you handle spam and abuse, and what the relay operator (you) and the VPS host can still see. This guide covers software choice, realistic sizing, a working TLS setup, and the metadata a relay cannot hide.
What a relay actually does
Nostr clients sign events (notes, reactions, profile updates, encrypted messages) with the user's key and publish them to one or more relays over WebSockets. A relay stores the events it accepts and streams them to clients whose subscription filters match. Relays don't talk to each other the way Matrix or XMPP servers federate. Clients do the work of spreading content across relays.
That shapes everything below:
- No federation means less server load. A relay only processes what clients send it and what they ask for.
- Events are signed, not secret. Most content on a relay is public by design. Running your own relay gives you control over availability and retention, not confidentiality.
- You're hosting other people's content if you accept writes from anyone. That's the main operational and legal cost.
If you're weighing Nostr against a federated chat server, the trade-offs are quite different. Our guide to self-hosted Matrix or XMPP sizing and metadata covers that side.
Three kinds of relay, three different jobs
Pick the relay type before you pick a server. The type drives cost and risk far more than software choice does.
Personal or backup relay. Only your own pubkey (and maybe a few others) can write, and anyone can read. Its job is to keep a durable copy of your notes that no third-party relay can delete. Load is negligible.
Private group or community relay. Writes and often reads are limited to an allowlist of pubkeys, enforced with NIP-42 authentication. It's useful for a team, a collective, or a paid membership. Load is moderate and predictable.
Open public relay. Anyone can write. This is where spam, storage growth, bandwidth fan-out and abuse reports all show up. Run one only if you're ready to moderate it.
Choosing relay software
Two mature, self-contained options cover most needs:
strfry (C++, LMDB storage). It's fast and memory-efficient, and it supports negentropy-based syncing between relays, which makes mirroring your own events from public relays efficient. A write-policy plugin system lets you accept or reject each event with a small script that reads JSON on stdin and returns a decision. That's the natural place to put a pubkey allowlist or custom spam rules. It's built from source, which needs build tools and some RAM during compilation.
nostr-rs-relay (Rust, SQLite by default). It's simple to run, especially from its container image. Configuration lives in a single config.toml, which includes a pubkey allowlist under its authorization settings. That makes it a quick way to stand up a personal relay.
There are also frameworks such as khatru (Go) for people who want to write custom relay logic. For a standard relay, either of the two above is enough. Check each project's current README before deploying, because option names and supported NIPs change between releases.
Sizing: what actually consumes resources
There's no honest single number for "RAM per user." Instead, here are the factors that drive each resource, so you can estimate your own case.
Disk. Text events are small, typically on the order of a kilobyte or less of JSON each. Indexes add overhead on top. A personal relay holding a few years of your own notes, reactions and follows takes up very little space. An open relay that accepts everything grows continuously, and spam makes it grow faster. Relays don't usually store images or video. Clients upload media to separate media hosts (for example, Blossom servers) and only the URL goes into the event. If you also run a media server, that becomes your real storage consumer.
RAM. strfry uses LMDB, which is memory-mapped. Tools like top may show the database's pages as memory "used," but most of that is page cache the kernel can reclaim. Watch real pressure (swap activity, OOM kills) instead of the headline number. If you compile strfry on a 1 GB server, add swap first or the build may get killed. Our low-RAM VPS tuning guide covers that setup.
Bandwidth. This is the cost people underestimate. Every accepted event goes out to every connected client whose filter matches, so outbound traffic is roughly events × matching subscribers. A personal relay with a handful of clients barely registers. A popular public relay pushes the same events to many clients over and over, and also answers large historical queries.
CPU. Each event's signature has to be verified on ingest. That's cheap per event but adds up under spam floods. Large unfiltered queries cost more than steady writes.
Mapped onto the current IronBalkans reference plans (check live pricing before you buy):
| Relay type | Reasonable starting plan | Why |
|---|---|---|
| Personal / backup relay | Iron 1 (1 vCPU, 2 GB, 20 GB SSD, 1 TB traffic) | Tiny dataset, few connections |
| Allowlisted group relay | Iron 1 or Iron 2 (2 vCPU, 4 GB, 50 GB SSD, 4 TB) | Headroom for more clients and a reverse proxy |
| Open public relay | Iron 2 to start, Iron 3 if traffic grows | Spam filtering, query load and fan-out bandwidth |
Measure before you upgrade. Track disk growth weekly and outbound traffic with vnstat. Our plan sizing guide explains how to read those numbers.
Deployment essentials
Whichever software you choose, the network layout should be the same:
- Bind the relay to localhost only. strfry's default port is 7777. In
strfry.conf, confirm the relay'sbindis127.0.0.1, not0.0.0.0. - Put a TLS reverse proxy in front. Clients expect
wss://, so the proxy has to pass WebSocket upgrades through. - Open only 80/443 publicly (80 is for ACME certificate renewal), plus whatever you use for SSH.
A minimal nginx location block:
location / {
proxy_pass http://127.0.0.1:7777;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_read_timeout 1h;
}
The long proxy_read_timeout matters. Nostr connections stay idle for long stretches, and nginx's default 60-second timeout will keep disconnecting clients.
Plans include one dedicated IPv4 address and no IPv6, so publish only an A record for the relay hostname. An AAAA record pointing anywhere else will break connections for IPv6-preferring clients.
Verify it works. NIP-11 says a relay serves an information document when asked with a specific Accept header:
curl -H "Accept: application/nostr+json" https://relay.example.com
You should get JSON with the relay's name, contact and supported NIPs. Then test the WebSocket path with a tool like websocat:
websocat wss://relay.example.com
["REQ","test",{"limit":1}]
A working relay answers with zero or more EVENT messages followed by EOSE (end of stored events).
Spam and abuse control
An open relay with no write policy will collect spam. Your options, from strongest to weakest:
- Pubkey allowlist. Only listed keys can publish. This is the right default for personal and group relays.
- NIP-42 authentication. Clients prove they control a key before reading or writing. Combine it with an allowlist to make a relay truly private, not just write-restricted.
- Proof of work (NIP-13). Require events to carry a minimum difficulty. This raises the cost of bulk spam, but determined spammers can still pay it, and it makes posting slower for legitimate users on weak devices.
- Rate limits and event-kind filters. Reject event kinds you don't want to store and cap messages per connection.
- Paid admission. Many public relays charge a one-off fee per pubkey. That's effective, but it means building payment handling.
The legal side matters too. An open relay will eventually store something unlawful, and abuse reports go to whoever hosts the IP. On a Romania VPS, reports are assessed under Romanian and EU law, not ignored. Read how abuse complaints and takedowns actually work before you open writes to everyone, and make sure you can delete events quickly. strfry has a delete command that takes a filter for this.
What a relay still sees about you and your users
Running your own relay doesn't make Nostr private. Be clear about what's exposed and to whom.
The relay operator (you) sees:
- Client IP addresses and connection times, unless clients connect through Tor or a VPN.
- Every subscription filter. That reveals who a user follows and which threads they read, which is often more sensitive than what they post.
- All events in plain form, except encrypted payloads.
Encrypted DMs leak differently by version. Legacy NIP-04 messages expose sender pubkey, recipient pubkey and timestamp to every relay that stores them. Only the content is encrypted. NIP-17 private messages (built on NIP-44 encryption and NIP-59 gift wrapping) hide the real sender and blur timestamps, which is a real improvement. Recipients and message volume are still partly observable. If your group relies on DMs, use clients that support NIP-17.
Logging is your choice. If you don't pass the real client IP from nginx to the relay (strfry has a realIpHeader setting), the relay only sees 127.0.0.1. That's better for privacy, but it breaks per-IP rate limiting inside the relay. You can rate-limit in nginx instead and keep nginx logs short or anonymized.
The VPS provider can technically see the traffic volume to your server, and with full infrastructure access, the disk. No-KYC registration and crypto payment remove your identity from the account. They don't make the server's contents invisible. Your relay's domain, TLS certificate and published NIP-11 contact field can also link it back to you. Leave the contact field generic, and see how logging in from home affects a no-KYC VPS for the admin-access side.
When a self-hosted relay is worth it
Self-host if you want a copy of your Nostr history that nobody else can purge, a private relay for a defined group, or a community relay you're prepared to moderate. Skip it if you just want to post: free and paid public relays already provide reach, and your own relay adds no audience unless people add it to their relay lists.
For a personal or allowlisted relay, the €7.99 Iron 1 plan is usually enough. You can register with no email or ID, pay in Monero, Bitcoin or Litecoin, and have the server running about two minutes after payment confirms. Start small, measure disk and bandwidth for a month, and size up only if the numbers say so.
