Lightweight, event-driven WebRTC helper for seamless browser-to-browser video connections.
PeerSetup abstracts WebRTC complexity and gives you a clean, predictable API to build real-time communication apps faster.
WebRTC is powerful — but complex.
PeerSetup handles the heavy lifting:
- 📷 Camera & microphone initialization
- 🔄 Offer / Answer negotiation
- ❄️ ICE candidate buffering
- 🎬 Local & remote media stream handling
- 🧹 Graceful connection cleanup
- 📡 Event-driven signaling structure
You focus on your app logic.
PeerSetup handles the WebRTC plumbing.
- ⚡ Simple API built on native WebRTC
- 🧩 Custom event system (
on,off,emit) - 🪶 Lightweight & framework agnostic
- 🔒 No external dependencies
- 📦 MIT Licensed
- 🧠 Clean internal architecture
npm install nahdi-flowrtcor
yarn add nahdi-flowrtcimport { PeerSetup } from "nahdi-flowrtc";const peer = new PeerSetup({
localVideoRef: document.getElementById("localVideo"),
remoteVideoRef: document.getElementById("remoteVideo"),
constraint: { video: true, audio: true }
});// ICE Candidate
peer.on("candidate", (candidate) => {
// Send candidate to your signaling server
});
// Remote Description
peer.on("RemoteDescription", (remote) => {
console.log(remote);
// Expected:
// "Succes-RemoteDescription"
});1. Create PeerSetup instance
2. Create Offer
3. Send Offer to signaling server
4. Receive Answer
5. Exchange ICE Candidates
6. 🎉 Peer connection established
peer.on(eventName, callback)
peer.off(eventName, callback)
peer.emit(eventName, data)PeerSetup is designed with:
- Clear separation of concerns
- Minimal abstraction
- Native WebRTC compliance
- Predictable lifecycle handling
No magic.
No hidden behaviors.
Just clean WebRTC logic.
Perfect for:
- 📹 Video chat applications
- 🧑💻 Collaboration tools
- 🎮 Browser P2P games
- 📡 Real-time streaming tools
- 📲 Web-based calling platforms
Contributions are welcome.
- Fork the repository
- Create a new branch
- Commit your changes
- Submit a pull request
MIT License
Free for commercial and personal use.
If you like this library:
- Give it a ⭐ on GitHub
- Share it with developers
- Use it in your next real-time app
🔥 Built for modern real-time web apps.
and you can see our pacakge in npm by @nahdi-flowrtc



