PeerJS is a peer-to-peer library that wraps WebRTC to provide a simpler API for browser-based connections.
The library abstracts away the complexity of WebRTC by offering a complete, configurable API for establishing direct connections between browsers. It supports both data channels for arbitrary message passing and media streams for audio and video. Developers create a Peer instance, then initiate or receive either data connections or media calls using straightforward method calls, with the underlying WebRTC signaling handled by PeerJS.
PeerJS suits projects that need direct browser-to-browser communication without server intermediaries for the actual data transfer. It works across modern versions of Chrome, Edge, Firefox, and Safari. The library requires a signaling server to establish initial connections between peers, though the actual data and media flow peer-to-peer once connected. The project provides an example application demonstrating both media and data connections, along with a companion PeerServer implementation for handling the signaling layer.
The project maintains active community engagement through a Discord channel where roadmap discussions and feature requests are coordinated. Development is responsive to compatibility concerns, with the team using BrowserStack to test against specified browser versions and treating browser support changes as breaking modifications. The codebase is written in TypeScript and built with Parcel, though there is a known non-critical console warning when bundling with Webpack that the maintainers plan to address in a future Parcel upgrade.