Set Up A Nostr Relay Server In Under 5 Minutes

Nostr Setup Guide

This article was originally published by André Neves on

This is a quickstart guide for those that wish to run a Nostr Relay. There are tens of relay server options and implementations, but to keep things simple for newcomers to the network, I’m using the friendly `nostream` built in TypeScript and packaged as a Docker Compose YML file.

Nostr Recap

nostr – Notes and Other Stuff Transmitted by Relays

Nostr is the simplest open protocol that is able to create a censorship-resistant global “social” network once and for all. It doesn’t rely on any trusted central server, hence it is resilient; it is based on cryptographic keys and signatures, so it is tamperproof; it does not rely on P2P techniques, therefore it works.

Recently Jack Dorsey checked out the Nostr protocol first released by ZEBEDEE developer fiatjaf and realized that there’s a LOT of promise and value to the protocol design decisions. So much that he deployed ~$250k to foster the Nostr development community.

While we are running a beefy production-ready nostr relay on already, I wanted to make a simple guide for newcomers that wish to run a relay server and begin interacting with the network themselves.

FWIW: this setup is different than the infrastructure setup for ``.

Let’s get started!

Setup VM

Choose your preferred VM provider – whether you prefer Linode, Digital Ocean, AWS, GCP, Azure, etc. For this quick guide I used the following setup in DigitalOcean:

  • Ubuntu 22.10, 8GB memory, 160GB NVME SSDs

I used these specs for this relay, but there are not yet enough benchmarks to suggest exactly which specs to choose.

Once you’re all setup, SSH into that VM and follow the next steps.

CLI Commands

# Update deps
sudo apt update
# Install nodejs, npm, nginx, certbot
sudo apt install nodejs npm nginx certbot python3-certbot-nginx
# Setup Docker GPG key
sudo mkdir -p /etc/apt/keyrings
curl -fsSL | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
# Setup `apt` Docker repository
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Install Docker
sudo chmod a+r /etc/apt/keyrings/docker.gpg
sudo apt update
sudo apt-get install docker-ce docker-ce-cli docker-compose-plugin
# Check installation is successful by checking verions
docker --version
npm --version
node --version
# Clone `nostream` repo
git clone
# Delete the default nginx settings file
rm -rf /etc/nginx/sites-available/default
# Paste in new settings file contents (see heading NGINX SETTINGS below)
sudo nano /etc/nginx/sites-available/default
# Restart nginx
sudo service nginx restart
# Map DNS A record to IP of VM machine (see DNS SETTINGS below)
# Request SSL cert from letsencrypt/certbot
sudo certbot --nginx -d
# Open a TMUX session (to be able to detach and maintain process running)
# Start the relay
npm run docker:compose:start
# To detach from the TMUX session
Ctrl+B  +  D
# To re-attach to the TMUX session
tmux a

Nginx Settings

Use the contents below as the contents of the `default` nginx setting.

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

Setup DNS A Record

To map your VM’s IP address to your you need to have an A record like below in your domain DNS settings.

You may need to setup a static/reserved IP address in order to map the A record to the

Check Relay Websocket Connectivity

In order to check that the relay is setup correctly, head on over to WebSocketKing and test the connection to your



That’s it! You’re all setup. This nostr server will ingest and relay any and all events broadcast to it. This isn’t necessarily how a production server would want to be run, but this is a good start.

For more information around limits and event types configuration read more at nostream GitHub repository. Also do note that nostream only supports the following NIPs (Nostr Improvement Protocol) at the moment:


Welcome to Nostr!

Join the #nostr Telegram group to join the development community around this project. You may want to add your relay to for discoverability.


Want Bitcoin-only Updates?

Weekly news roundups direct to your inbox!

Subscribe for Bitcoin-only Updates

Get weekly news roundups direct to your inbox!


Get Published Now

To promote Hyper-Bitcoinization, we’re inviting all Bitcoiners to share their stories, analysis and opinions with us and get rewarded with Bitcoin!


Stay Informed And Up to Date!

Subscribe To Our Weekly Newsletter

Stay Informed with Breaking News

Get breaking Bitcoin-Only content delivered straight to your inbox every week!

Bitcoin-Only Content Sent Directly to your Inbox!