peerjs-server
Server for PeerJS
PeerServer is the back-end companion to PeerJS, a JavaScript library that lets two browsers connect directly to each other and exchange data or media without routing everything through a central server. The PeerServer piece is a coordination layer: when two clients want to find each other, they both register with PeerServer, and it tells them how to reach one another. After that introduction, all the actual data flows directly between the browsers and the server is no longer involved.
You can run it as a standalone process by installing it globally with npm and launching it on a port of your choosing. It is also available as a Docker image, so you can spin up a container with one command if you prefer that approach. Alternatively, if you already have a Node.js web server running, you can attach PeerServer to it as a module rather than running a separate process.
The server has a small set of configuration options. You can set a connection key that clients must supply, adjust timeouts for dropped connections, limit how many clients can connect at once, and enable HTTPS by providing an SSL certificate. There is also an optional endpoint that returns a list of all currently connected client IDs, though this is disabled by default.
Clients connect to it from the browser by pointing their PeerJS instance at the host and port where PeerServer is running. From there, PeerJS handles the peer-to-peer handshake automatically.
This project is useful when you want to build something like a video call, file transfer, or real-time collaboration tool and need a simple way to let browsers find each other. Running your own PeerServer means you are not dependent on a third-party hosted service and you control who can use it.