From nothing to a Noscat mesh that runs entirely on infrastructure you control: your own relay, your own STUN server and your devices. No company or account is involved, and no third-party server learns which devices are in your mesh or where they are.
You will copy commands into a terminal on a small server, then join your computers and phone. No programming is needed.
noscat-relay passes the mesh's control messages between devices: who is a member, invitations, "I'm online here" notes. Every one is encrypted, and it serves only your mesh's devices.
An ordinary member that is reachable from the internet, so devices behind home routers and on mobile networks connect through it when they cannot connect directly.
Built into the relay. It tells your devices their public addresses so they can connect directly where possible, without asking Google or any other third party.
Membership, invitations and presence go only through your relay. Files, chat, forwards and terminals go device to device, end-to-end encrypted. Your devices never contact public Nostr relays or public STUN servers.
There is no coordinator and no owner. Every member can invite and remove devices, and every member checks the group's state for itself (it is an MLS group, the IETF standard for group encryption). The server is just one member.
Each device makes its own key; there is no account to take over and no password to leak. The relay stores only encrypted messages it cannot read, and traffic the server passes between two devices is encrypted between those two devices.
sudo.relay.example.com.Every command in steps 1 to 5 runs on the server, over SSH, as your normal user (not root). sudo is used only where needed.
At your domain registrar or DNS provider, add an A record from relay.example.com to 203.0.113.10. It can take a few minutes to apply. Check it from any computer:
ping -c 1 relay.example.com # should show 203.0.113.10
Open these ports on the server. If your provider has a firewall in its web dashboard, open them there too.
| Port | For |
|---|---|
TCP 80, 443 | HTTPS for the relay (Caddy, which gets the certificate) |
UDP 41641 | Noscat: your devices connect to the server here |
UDP 3478 | STUN: your devices learn their public address here |
With ufw (Ubuntu's firewall; on Debian, sudo apt install ufw first):
sudo ufw allow OpenSSH sudo ufw allow 80,443/tcp sudo ufw allow 41641/udp sudo ufw allow 3478/udp sudo ufw enable
curl -fsSL https://raw.githubusercontent.com/Letdown2491/noscat/main/packaging/install.sh | sh
This puts noscat in ~/.local/bin. Check it works (log out and back in first if noscat is not found), and give the server a name your devices will show (optional; it is the hostname otherwise):
noscat --version noscat name server
Download the relay (a single file) and its two configuration files. This is for x86_64 servers; on ARM, use noscat-relay-linux-arm64 in the first curl:
mkdir -p ~/noscat-relay && cd ~/noscat-relay curl -fsSL -o noscat-relay https://github.com/Letdown2491/noscat-relay/releases/latest/download/noscat-relay-linux-amd64 chmod +x noscat-relay curl -fsSLO https://raw.githubusercontent.com/Letdown2491/noscat-relay/main/noscat-relay.service curl -fsSL -o .env https://raw.githubusercontent.com/Letdown2491/noscat-relay/main/.env.example
Prefer to build it yourself? The relay's README shows how, with Go.
Open .env in an editor (nano .env) and set these three lines; the other settings can stay as they are:
RELAY_URL="wss://relay.example.com" MEMBERS_COMMAND="$HOME/.local/bin/noscat mesh members" STUN_ADDR=":3478"
RELAY_URL must be exactly your domain with wss:// in front: devices log in to the relay by name, and a mismatch refuses every login.MEMBERS_COMMAND is how the relay learns who may use it: it asks the server's Noscat device for the mesh's members, every minute.STUN_ADDR turns on the relay's STUN server.Save (in nano: Ctrl+O, Enter, Ctrl+X), then run the relay as a service that starts at boot:
mkdir -p ~/.config/systemd/user cp noscat-relay.service ~/.config/systemd/user/ systemctl --user daemon-reload systemctl --user enable --now noscat-relay sudo loginctl enable-linger "$USER" # keep your services running when you log out journalctl --user -u noscat-relay -n 20
Relay listening on 127.0.0.1:3340 for wss://relay.example.com and STUN on udp [::]:3478. Lines saying members: source listed nobody are expected for now: there is no mesh yet.Caddy gets a free certificate for your domain and renews it by itself. Install it, then replace the contents of /etc/caddy/Caddyfile with these three lines (sudo nano /etc/caddy/Caddyfile):
sudo apt install caddy
relay.example.com {
reverse_proxy localhost:3340
}Then reload Caddy and check the relay answers over HTTPS:
sudo systemctl reload caddy curl -s -H 'Accept: application/nostr+json' https://relay.example.com
curl prints a short JSON description of the relay (its name, "noscat relay"). If it fails, wait a minute while the certificate is issued, and check that ports 80 and 443 are open and the A record is right.Start the server's Noscat device as a service. It uses only your relay from the start, and tells the mesh it is reachable at its public address:
noscat --relay wss://relay.example.com --reachable 203.0.113.10:41641 service install noscat service status
Now create the mesh (call it whatever you like; home here), make it private, and give it your STUN server:
noscat mesh create home noscat mesh private noscat mesh stun add 203.0.113.10:3478 noscat mesh relays
noscat mesh relays should say the mesh is private and list only wss://relay.example.com. Within a minute the relay's log shows members: 1 (was 0): the server is in.Every new device joins the same way: it reads the server's pairing code, asks to join, and you approve it on a member. On the server, show the pairing code:
noscat mesh qr
It prints a QR code and a line like noscat:npub1...?relay=wss%3A%2F%2Frelay.example.com. The ?relay= part matters: it tells a new device to use your relay and nothing else, so not even its first message reaches a public relay. Always use the whole code.
noscat: line.noscat: line into the join screen and press Request to join.noscat service install to keep it running.noscat mesh join 'noscat:npub1...?relay=wss%3A%2F%2Frelay.example.com'
A joined device needs no --relay: a device in a private mesh uses the mesh's relays by itself.
On the server, while the new device waits:
noscat mesh requests
y/n for each. Check the npub against the one the new device shows on its screen before answering y: the name is the device's own claim, the npub is its identity. Once one app device is in, you can approve the rest from its Devices tab instead.noscat mesh members
Every device should be listed as online and connected; in the apps, the ring around the Noscat logo turns green. Try it: send a chat message or a file from your phone to your laptop. It goes device to device, or through your server, encrypted, when the two cannot reach each other directly.
noscat mesh remove <its npub> on any member with the command line; noscat mesh members lists the npubs. Its key no longer opens anything in the mesh, and the relay refuses it at once. (The apps cannot remove other devices yet; a phone or computer leaving on its own uses Forget mesh in its Settings.)noscat allow laptop control.noscat service install with the same options as in step 5. For the relay: run the first three lines of step 3 again, then systemctl --user restart noscat-relay.~/.local/share/noscat. If the server is lost, set up a new one, join it as a new device, and remove the old server's npub. Your other devices keep their keys and their place in the mesh.| What you see | Likely cause and fix |
|---|---|
| A device stays "online" but never "connected" | UDP 41641 is blocked on the server (step 1, including the provider's firewall), or the address in --reachable is wrong. |
Nothing ever connects (the apps stay amber), though curl works | RELAY_URL in .env does not match the domain exactly (wss://, no trailing slash), so every login is refused. Fix it and restart the relay. |
curl https://relay.example.com fails | The A record is not there yet, or TCP 80 or 443 is closed (Caddy needs both). sudo journalctl -u caddy -n 50 says which. |
| A joining device waits forever | The request went to a member nobody is approving: run noscat mesh requests on the device whose code you used. Or the code was cut short: use the whole noscat: line. |
| Devices take a long time to connect directly | UDP 3478 is closed, so STUN does not answer; devices still connect, through the server. Open the port and restart the apps. |
journalctl --user -u noscat -f # the server's Noscat device journalctl --user -u noscat-relay -f # the relay
The domain is there only so the relay can have an HTTPS certificate. You can skip it today with a plain ws:// relay on the server's IP address: in .env, set the two lines below, open TCP 3340 instead of 80 and 443, and skip step 4. Everywhere this guide says wss://relay.example.com, use ws://203.0.113.10:3340.
RELAY_URL="ws://203.0.113.10:3340" RELAY_PORT="0.0.0.0:3340"
Going further: moving an existing mesh onto your own relay is in noscat-relay's README; the protocol is in the NIP.