From e30de01c86ad98144d412cee3b180dc6e239ca4e Mon Sep 17 00:00:00 2001 From: Patrick Charrier Date: Sun, 15 Mar 2026 04:56:40 +0100 Subject: [PATCH] Improve README with usage instructions and tech overview Co-Authored-By: Claude Opus 4.6 --- README.md | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0217c70..6d0bc51 100644 --- a/README.md +++ b/README.md @@ -1 +1,40 @@ -# P2P Poll App \ No newline at end of file +# P2P Poll App + +A peer-to-peer polling app where users can add options and vote on them. All data syncs directly between browsers using WebRTC — no central server stores any poll data. + +## How It Works + +- **Yjs CRDTs** handle shared state — concurrent edits from different peers merge automatically without conflicts +- **y-webrtc** establishes direct WebRTC connections between browsers (a public signaling server is used only for peer discovery) +- Each user gets a stable random ID (stored in localStorage) ensuring one vote per user per option +- Polls are identified by room name, shareable via URL + +## Getting Started + +```bash +npm install +npm run dev +``` + +Open `http://localhost:5173` in your browser. To share a specific poll, use the `?room=` query parameter: + +``` +http://localhost:5173/?room=my-poll +``` + +Share this URL with others to join the same poll. + +## Cross-Device Testing + +```bash +npm run dev -- --host +``` + +Then open `http://:5173/?room=test` on another device on the same network. + +## Tech Stack + +- [Yjs](https://yjs.dev/) — CRDT library for conflict-free shared state +- [y-webrtc](https://github.com/yjs/y-webrtc) — WebRTC provider for P2P connectivity +- [Vite](https://vite.dev/) — Dev server and bundler +- Vanilla JS — No framework dependencies