Guide · 30 to 45 minutes

Set up a private mesh

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.

Your server

Enter these and the commands on this page will use them. What you type stays in your browser.

What you end up with

One small server and your devices

public relays never contacted public STUN never contacted your server (a small VPS) noscat-relay: members only STUN on UDP 3478 Noscat, --reachable laptopcafé Wi-Fi raspberry piat home desktopat home phonemobile data

The relay

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.

The server's Noscat device

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.

STUN

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.

What private means here

Private, decentralized and trustless

Private

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.

Decentralized

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.

Trustless

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.

What this does not hide

What you need

  • A server with a public IPv4 address: any small VPS (1 CPU and 1 GB of RAM is plenty) running Debian 12 or 13, or Ubuntu 24.04, with SSH access and sudo.
  • A domain name (or a subdomain of one you own) that you can point at the server, for example relay.example.com.
  • Your devices: Linux, macOS or Windows computers, Raspberry Pis, and Android phones.

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.

1

Point your domain at the server, and open its ports

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.

PortFor
TCP 80, 443HTTPS for the relay (Caddy, which gets the certificate)
UDP 41641Noscat: your devices connect to the server here
UDP 3478STUN: 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
2

Install Noscat on the server

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
3

Install the relay

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
You should see 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.
4

Put HTTPS in front of the relay

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
The 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.
5

Create the mesh on the server

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.
6

Join your devices

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.

A phone (Android)

  1. Install the APK from the Android releases and open it.
  2. Tap Scan pairing code and scan the QR in your SSH terminal, or paste the noscat: line.
  3. Approve it on the server (below).

A desktop computer (the app)

  1. Install Noscat for desktop from its releases and open it.
  2. Paste the whole noscat: line into the join screen and press Request to join.
  3. Approve it on the server (below).

Any computer or Pi (command line)

  1. Install Noscat, then run the join below.
  2. Keep the single quotes: the code has characters your shell would change.
  3. Approve it on the server, then 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.

Approving on the server

On the server, while the new device waits:

noscat mesh requests
It lists the devices that asked to join and asks 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.
7

Check it works

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.

Day to day

  • Adding a device: step 6 again, with any member's pairing code (in the apps: Invite a device).
  • Removing a lost or sold device: 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.)
  • Terminals and access: each device decides what the others may do to it. The server has no app to ask you, so it refuses terminals until you allow a device: noscat allow laptop control.
  • Updating: rerun the install line from step 2 and 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.
  • Backups: the server's identity and mesh state are in ~/.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.

If something is not working

What you seeLikely 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 worksRELAY_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 failsThe 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 foreverThe 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 directlyUDP 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

Without a domain

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"
The cost: the connection to the relay is not encrypted. Messages stay end-to-end encrypted and signed, so nobody on the way can read or forge them, but anyone between your devices and the server (a café's Wi-Fi, an ISP) can see which device keys log in, when, and how much they send. Noscat 0.6.1 removes the trade-off: the relay makes its own certificate and your pairing code carries its fingerprint, so there is no domain, no DNS and no certificate authority, and the connection is still encrypted.

Going further: moving an existing mesh onto your own relay is in noscat-relay's README; the protocol is in the NIP.