{"slug": "trystero-serverless-peer-to-peer-multiplayer-for-the-web", "title": "Trystero – Serverless peer-to-peer multiplayer for the web", "summary": "Trystero, a serverless peer-to-peer multiplayer library for the web, lets any static site become a live multiplayer app via a single `npm i trystero` install, with no accounts, API keys, or infrastructure required. Rooms provide ECDSA P-256-derived persistent user identities verified during the WebRTC handshake, signed per-user and shared state that syncs to late joiners, an optional `roles()` plugin for verified admins and peer bans, and live audio/video, with handshakes encrypted using AES-256-GCM and PBKDF2-SHA256 key derivation when a `password` is set. An experimental `scale()` plugin switches rooms past `maxDirectPeers + 1` peers to a multi-hop gossip overlay for messages and state while promoting media and large binary transfers to direct links.", "body_md": "Trystero turns any static site into a live multiplayer app. Import the library, join a room by name, and browsers discover each other instantly.\n\nNo accounts, no API keys, no infra. Perfect for coding agents.\n\n`npm i trystero`  Rooms include verified user identities, synced per-user and shared state, host permissions, RPC, chunked file transfers, and live audio and video. Ship a multiplayer game or collaborative tool from GitHub Pages, Neocities, or a single HTML file.\n\nThe cursors moving across this page belong to other visitors connected through Trystero.\n\nOpen this in two browsers and move your pointer. You can also skip a\n            bundler and import directly from `https://esm.run/trystero`\nin a module script.\n\nMultiplayer apps usually track two kinds of state: per-user values each participant owns (names, cursors, ready flags) and shared room values for the group (a game board, round timer, or playback queue).\n\nWrites apply locally right away, coalesce rapid updates on the wire, carry the author's signature, and sync to late joiners even after the original writer leaves.\n\nBoth primitives match React's `useSyncExternalStore`\ncontract directly.\n\nEvery participant gets a persistent `userId` derived\n            from an ECDSA keypair and verified during the WebRTC handshake,\n            with no login flow or auth server. Refreshing or opening another\n            tab keeps the same identity, and `identity` config\n            supports ephemeral per-tab keys or keys imported from your app.\n\nCombine `password` and `maxUsers` for\n            private, seat-limited rooms such as a two-player match or four-seat\n            lobby.\n\nPlain peer-to-peer rooms treat every participant equally, which breaks down when any client can open DevTools and overwrite game state.\n\nThe optional `roles()` plugin adds verified room admins,\n            custom roles like `'dj'` or `'moderator'`,\n            role-gated state and actions, and peer bans. Peers verify every\n            write against the author's signature and role certificate, dropping\n            unauthorized edits on arrival.\n\nCreate named channels with `room.makeAction()` for\n            ephemeral events, request/response calls, and binary transfers.\n            Send strings, JSON, `Blob` s, `File` s, or\n            typed arrays; Trystero handles framing, chunking, backpressure,\n            metadata, and transfer progress.\n\nLarge files use the same channel API as small messages and stream directly between peers without intermediate storage.\n\nSend microphone audio, webcam video, screen captures,\n`canvas.captureStream()`, or Web Audio output to the\n            room or to specific users. Tag streams with `metadata`\nto distinguish camera feeds from screen shares, and swap tracks\n            mid-call with `replaceTrack`.\n\nStandard WebRTC rooms connect every browser directly to every\n            other, which suits small groups and low-latency matches. For larger\n            cooperative sessions, add the experimental `scale()`\nplugin.\n\nSmall rooms stay in a direct mesh. Past\n`maxDirectPeers + 1` peers, browsers form a multi-hop\n            gossip overlay for messages and state while promoting media streams\n            and large binary transfers to direct links on demand.\n\nTrystero also runs in server and CLI runtimes with a WebRTC\n            polyfill. Run a game bot, bridge local hardware, or keep a\n`passive: true` peer online to cache signed room state\n            while browser tabs are closed.\n\nIdentity, state, and signaling encryption rely on Web Crypto primitives verified directly by peers.\n\nHandshakes are encrypted with AES-256-GCM before reaching any\n              relay. Default rooms derive the key from `appId` and\n`roomId`; setting `password` derives it via\n              PBKDF2-SHA256 so outsiders cannot decrypt offers or join.\n\nEvery `userId` and `peerId` derives from an\n              ECDSA P-256 public key bound to the WebRTC DTLS certificate\n              fingerprint (RFC 8827), preventing peer spoofing and relay\n              man-in-the-middle attacks.\n\nState updates and role certificates carry ECDSA signatures and Hybrid Logical Clock timestamps, so any peer or late joiner can verify authorship and ordering independently.\n\nArchitecture notes and walkthroughs for building peer-to-peer web apps.", "url": "https://wpnews.pro/news/trystero-serverless-peer-to-peer-multiplayer-for-the-web", "canonical_source": "https://trystero.dev/", "published_at": "2026-11-16 16:35:14+00:00", "updated_at": "2026-11-16 16:54:55.836048+00:00", "lang": "en", "topics": ["developer-tools", "ai-agents", "agent-protocols"], "entities": ["Trystero", "WebRTC", "Web Crypto", "ECDSA P-256", "AES-256-GCM", "PBKDF2-SHA256", "React"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/trystero-serverless-peer-to-peer-multiplayer-for-the-web", "markdown": "https://wpnews.pro/news/trystero-serverless-peer-to-peer-multiplayer-for-the-web.md", "text": "https://wpnews.pro/news/trystero-serverless-peer-to-peer-multiplayer-for-the-web.txt", "jsonld": "https://wpnews.pro/news/trystero-serverless-peer-to-peer-multiplayer-for-the-web.jsonld"}}