Welcome to Peerix
My name is Anton Skshidlevsky (aka meefik), and I’m a software engineer with over twenty years of experience in software development and over ten years of experience in building WebRTC web applications. Today, I’m excited to announce the first release of Peerix, a JavaScript/TypeScript open-source library designed to simplify building WebRTC peer-to-peer applications. After months of development and testing, Peerix is now available for developers to use and contribute to.
Background
Over ten years ago, I started building peer-to-peer web applications using WebRTC. It was an exciting but often frustrating journey, as I had to repeatedly solve the same problems around signaling, connection management, and media/data exchange across browsers and devices. However, from time to time, things went wrong. I wanted a simpler way to build these apps without reinventing the wheel every time, but existing libraries didn’t quite fit the bill.
That’s exactly why I created Peerix, which brings all of this expertise together. It abstracts away the complexities of WebRTC and provides a clean, minimal API for building peer-to-peer apps quickly and reliably. Whether you’re building a simple chat app, a video conferencing service, a collaborative tool, or a more sophisticated multi-stream, multi-channel experience, Peerix aims to make it easier to get up and running without getting bogged down in the details of signaling and connection management. I’m excited to share it with the community and see what you build with it!
Currently, Peerix implements core functionality around WebRTC and peer-to-peer connections. Even now, it supports a wide range of use cases, from simple data sharing to multi-stream media applications. The core API is designed to be minimal and intuitive, with sensible defaults for signaling and connection management. Just a few lines of code are needed to get started. In the future, we plan to add more features and add-ons, as well as additional signaling drivers to further enhance the capabilities of Peerix.
Why peer-to-peer
Peer-to-peer communication has many advantages, including lower latency, better privacy, and reduced server costs. By connecting peers directly, you can build applications that are more responsive and scalable, without relying on centralized servers for media processing or routing. Peerix is designed to make it easy to build these kinds of applications, allowing you to focus on building your application’s features and user experience, rather than dealing with the complexities of WebRTC and signaling.
I admit that sometimes a server-side component is necessary, especially for media processing or routing in large-scale applications. However, for many use cases, a pure peer-to-peer architecture can provide significant benefits. With the correct configuration, each peer can connect to dozens of other peers without hitting performance issues, and the server can be reserved for signaling and coordination rather than media processing. You can have thousands of rooms with dozens of peers each, all without needing a single SFU or MCU. You can even do some media processing directly in the browser with add-ons, such as recording or mixing, without needing to route media through a server. So peer-to-peer is powerful and can be the right choice for many applications, and Peerix is here to make it easier to build those applications.
Why Peerix
WebRTC is powerful but complex. Most apps re-implement the same boilerplate: signaling channels, ICE configuration, connection lifecycle, and multi-track negotiation. That complexity slows prototyping, increases bugs, and raises the barrier for developers who just want to share media or data peer-to-peer.
Interestingly, there are not many libraries that offer a clean, well-documented abstraction over WebRTC, including modern concepts like multi-track, data channels, and pluggable signaling. Many libraries focus on specific use cases (e.g., video calls) or require server-side components (e.g., SFUs). Peerix fills the gap for a flexible, transport-agnostic client-side library that abstracts away the common complexities of WebRTC while still allowing you to build a wide range of peer-to-peer applications.
The problem it solves
Typical WebRTC apps face several challenges:
- Signaling vendor lock-in: many libraries tie you to a specific signaling method (e.g., WebSockets), making it hard to switch or support multiple transports.
- Hard-to-manage negotiations of multiple media streams and data channels across multiple peers in mesh and room-based topologies.
- STUN/TURN and reconnection complexities that leak into app code.
- Extra boilerplate for additional functionality like E2E encryption, recording, storage, state synchronization, etc.
Peerix centralizes these concerns in a single Peer class and a pluggable driver model for signaling, so the same API works locally (MemoryDriver), between tabs (BroadcastChannelDriver), or across the internet (NATS driver or custom drivers). It can be extended with add-ons without modifying your core app logic.
Core idea
Peerix provides a simple yet powerful abstraction of WebRTC with transport-agnostic architecture and extends its capabilities with add-ons, all while keeping the API minimal.
At the heart of Peerix is a simple principle: a room-based topology involves a single connection per peer and multiplexes media tracks and data channels over that connection using transport-agnostic drivers. This reduces signaling chatter and avoids creating multiple redundant peer connections for each stream or channel. The pluggable driver model abstracts away the signaling transport, allowing you to choose or implement the one that best fits your use case without changing your app code. The library exposes clear lifecycle events so that apps can react declaratively.
Advantages
Let’s summarize the key advantages of Peerix:
- Minimal API surface: quick to learn and integrate.
- Pluggable signaling drivers: swap BroadcastChannel, NATS, or your own driver over WebSockets.
- Single-connection multiplexing: efficient resource use and simpler negotiation.
- Flexible: share multiple streams, open multiple data channels, and attach add-ons to extend functionality.
Who is it for
Peerix is for developers building real-time apps such as chat, conferencing, file sharing, collaborative tools, and games who want to avoid reimplementing signaling and connection plumbing, and who need a flexible, extensible foundation for peer-to-peer communication in the browser. If you want to build peer-to-peer web apps without reinventing the wheel, Peerix is for you.
When not to use it
If you need server-side media processing or routing, Peerix is not an SFU (Selective Forwarding Unit) or MCU (Multipoint Control Unit).
License
Peerix is licensed under the Apache License, Version 2.0. This means you can use, modify, and distribute Peerix in your open-source or commercial projects without any restrictions. See the LICENSE file for details.
Future plans
In the future, we plan to expand Peerix with additional features and signaling drivers. Some of the upcoming features include:
- Additional signaling drivers: SSE driver, Socket.IO driver, Supabase driver, and more.
- Recording add-on: easily record media streams or data channels.
- State synchronization add-on: keep application state in sync across peers.
- Video/audio mixing add-on: mix multiple media streams together for composite outputs.
Get started
A code snippet to illustrate how simple it is to get started with Peerix:
import { Peer, BroadcastChannelDriver } from 'peerix';
// create a signaling driver
const driver = new BroadcastChannelDriver();
// create a Peer instance
const peer = new Peer({ driver });
// listen for events
peer.on('channel:open', ({ channel }) => channel.send('hello'));
peer.on('channel:message', ({ data }) => console.log('msg', data));
// open a data channel
peer.open({ label: 'chat' });
// join a room
peer.join({ room: 'room-id' });See the Getting Started guide to install Peerix and try it in your browser. Contributions, issues, and driver add-ons are welcome — Peerix aims to be a practical, community-driven toolkit for peer-to-peer web apps.
Welcome aboard — now let’s make peer-to-peer apps easier.
Conclusion
Eventually, we hope Peerix will become a go-to library for developers building peer-to-peer web applications, providing a solid foundation that abstracts away the complexities of WebRTC while still allowing for flexibility and extensibility. We look forward to seeing what the community builds with Peerix and welcome contributions to help make it even better.
