I Built a Serverless P2P Chat That Runs Directly in Your Browser
Most chat applications work like this:
User A β Server β User B
Every message goes through a server.
This works well, but it also means:
Messages pass through a central server
The server must handle all traffic
It requires backend infrastructure
So I wanted to try something different.
I built a peer-to-peer chat tool that runs entirely in the browser.
No accounts.
No installation.
No chat server.
Just open the page and start chatting.
Try it here:
π https://xto.icu/tools/p2p-chat/
The Idea
Instead of sending messages through a server, the browsers connect directly to each other.
Browser A ββ WebRTC ββ Browser B
Once the connection is established, messages travel directly between the two users.
No message storage.
No central chat server.
This is possible thanks to WebRTC, a browser technology designed for real-time communication.
WebRTC allows browsers to exchange data directly using RTCDataChannel, which supports low-latency peer-to-peer communication.
How It Works
The process is simple:
User A opens the chat tool
A session code is generated
User B enters the same session code
The browsers establish a WebRTC connection
Messages flow directly between the two browsers
User A
β
β session code
βΌ
User B
β
βΌ
WebRTC connection
β
βΌ
Direct chat
Once connected, the chat behaves like a normal messaging app.
But under the hood, it's completely peer-to-peer.
Features
Current features of the tool:
π¬ Real-time chat
π Peer-to-peer connection
π Encrypted WebRTC communication
π Runs entirely in the browser
π Free to use
There is no signup and no installation required.
Just open the page and connect.
Why I Built This
I enjoy experimenting with what modern browsers can do.
Many developers still think browsers are only for displaying web pages.
But today browsers can do much more:
Real-time communication
Peer-to-peer networking
File transfers
Collaborative apps
All without installing anything.
Just open a webpage.
Possible Use Cases
Some interesting ways this tool can be used:
Quick private chats
Temporary communication
Testing WebRTC connections
Developer experiments
Learning about peer-to-peer networking
Try It Yourself
Open the tool on two devices or two browser tabs:
π https://xto.icu/tools/p2p-chat/
Share the session code and start chatting.
That's it.
What's Next
I'm currently experimenting with more browser-based P2P tools, such as:
P2P file transfer
P2P clipboard sharing
P2P streaming
More WebRTC experiments
Modern browsers are more powerful than many developers realize.
If you try the tool, Iβd love to hear your feedback.
What features should I add next?
Top comments (2)
The interest part is the Signaling Server.
How did you implement it?
I wrote a simple Signaling Server in PHP because I have this dumb Webspace and don't need a cloud subscription or anything to run it:
github.com/htho/php-webrtc-signali...
Good question!
The connection uses WebRTC with Cloudflare's public STUN server (stun:stun.cloudflare.com:3478) for NAT traversal.
The signaling mechanism is intentionally lightweight and only exchanges the SDP offer/answer and ICE candidates required to establish the connection.
Once the peer connection is established, all chat messages are sent directly peer-to-peer via WebRTC data channels.