2462872e2428c59ce4c93fb859ad78fa0eec03a4
P2P Poll App
A peer-to-peer polling application where users create and vote on polls without any central server. All data syncs directly between browsers using WebRTC and CRDTs.
Features
- Real-time P2P sync — poll options and votes sync instantly across all connected peers via WebRTC
- Collaborative poll title — editable title that syncs between all participants
- One vote per user — each peer gets a stable ID, enforcing one vote per person per option
- Vote/Unvote toggle — change your mind anytime
- Connection status — see when you're connected and how many peers are in the room
- Shareable polls — share via URL with
?room=your-poll-name - No backend required — runs entirely in the browser
Tech Stack
- Yjs — CRDT library for conflict-free shared state
- y-webrtc — WebRTC provider for peer-to-peer connections
- Vite — Development server and build tool
- Vanilla JavaScript — no framework dependencies
Getting Started
npm install
npm run dev
Open http://localhost:5173/?room=my-poll in multiple browser tabs to test.
To test across devices on the same network:
npm run dev -- --host
Then open the URL shown in the terminal on other devices.
How It Works
- Each browser tab creates a Yjs document and connects to other peers via WebRTC
- Poll options and votes are stored in Yjs shared data types (Y.Map)
- Changes propagate automatically to all connected peers using CRDTs
- A public signaling server handles peer discovery; all poll data flows directly between browsers
Description