DEV Community

Spiral200
Spiral200

Posted on

I built js-setowire – P2P networking for Node.js with no central servers

I got tired of P2P libraries that are either too heavy or require
a broker/signaling server. So I built js-setowire.

What it does

Peers find each other and talk directly over UDP. No central server,
no WebRTC, no broker.

Discovery runs multiple strategies in parallel — whichever works first wins:

  • DHT (decentralized)
  • LAN multicast (instant on local networks)
  • HTTP bootstrap nodes (fallback)

All traffic is E2E encrypted with X25519 + ChaCha20-Poly1305.

Try it in 30 seconds

git clone https://github.com/setowire-org/js-setowire
node chat.js alice myroom

on another machine:

node chat.js bob myroom

The protocol fits in your head

Plain UDP. 1-byte frame type. Two handshake frames to exchange
keys, then everything is encrypted. Simple enough to reimplement
in any language.

GitHub: https://github.com/setowire-org/js-setowire

Top comments (0)