# Dendri > Open-source, self-hostable WebRTC signaling stack for realtime collaboration apps. Framework-neutral TypeScript SDK (Apache-2.0) plus a Rust signaling server (AGPL-3.0). Provides four-tier connectivity fallback (direct P2P, STUN, TURN, encrypted TLS relay), multi-transport signaling (WebSocket, SSE, long-poll), rooms with host migration, typed presence, RPC with ACK delivery, end-to-end encrypted relay, JWT auth, and Yjs CRDT support. Dendri is *not* the Matrix homeserver Dendrite (matrix-org/dendrite) — it is an unrelated WebRTC signaling project from Afterrealism Pty Ltd. Dendri is **self-host-first**: the SDK never ships a default signaling host and will not silently connect to any Afterrealism-operated server. Every app must point at its own server URL (or an explicitly configured hosted endpoint). ## Documentation Every page below is also served as plain markdown at `index.md` next to the HTML (e.g. https://dendri.dev/docs/quickstart/index.md), and the full set is inlined in [llms-full.txt](https://dendri.dev/llms-full.txt). - [Introduction](https://dendri.dev/docs/): what Dendri is, architecture, core concepts (peers, rooms, presence, topics, RPC, store), packages, licensing overview. - [Quickstart](https://dendri.dev/docs/quickstart/): run a server (hosted or local Podman/cargo), install the SDK, build a working P2P chat. - [Configuration](https://dendri.dev/docs/configuration/): full client option reference, signaling transports, TURN, encrypted relay, connection lifecycle, multi-tab behaviour. - [Framework guides](https://dendri.dev/docs/frameworks/): complete React, Vue, Svelte, and vanilla JS integrations using the official adapters (`/react`, `/vue`, `/svelte` subpath exports). - [Building the examples](https://dendri.dev/docs/examples/): walkthroughs of chat, live cursors, presence, whiteboard, file transfer, video chat, and a multiplayer game. - [Collaborative editing](https://dendri.dev/docs/collaboration/): Yjs CRDT sync and awareness over a Dendri room with `@afterrealism/dendri-y`. - [Migrating from PeerJS](https://dendri.dev/docs/migrate-peerjs/): option-by-option mapping from PeerJS (same connect/call API shape), server replacement, and the room/presence/RPC upgrades to adopt after parity. - [API reference](https://dendri.dev/docs/api/): `Dendri`, `Room`, `DendriStore`, data/media connections, adapters, `DendriServerAPI`, `DendriYjsProvider`. - [Self-hosting](https://dendri.dev/docs/self-hosting/): Podman/Docker deployment, server flags, HTTP endpoints, TLS, TURN with coturn, Redis, scaling, licensing. - [AI & agents](https://dendri.dev/docs/ai/): this llms.txt, the markdown mirror, and the hosted MCP endpoint at https://dendri.dev/mcp for coding agents (Claude Code, opencode, Cursor, VS Code). ## Project - [Marketing site](https://dendri.dev/): overview, live demos, pricing. - [GitHub backlog & issues](https://github.com/afterrealism/dendri-backlog): public issue tracker and roadmap. - [Afterrealism org](https://github.com/afterrealism): all Dendri repositories live here. ## Packages - [@afterrealism/dendri-client](https://www.npmjs.com/package/@afterrealism/dendri-client): framework-neutral TypeScript SDK. Apache-2.0. Entry points `.`, `./store`, `./msgpack`, plus framework adapters `./react`, `./vue`, `./svelte` (ESM + CJS). Runtime deps: `eventemitter3`, `webrtc-adapter`, `@msgpack/msgpack`. - [@afterrealism/dendri-y](https://www.npmjs.com/package/@afterrealism/dendri-y): Yjs CRDT provider built on top of `dendri-client`. Apache-2.0. `yjs`, `y-protocols`, and `@afterrealism/dendri-client` are peer dependencies. - [Dendri docs MCP endpoint](https://dendri.dev/mcp): hosted Streamable HTTP MCP server for this documentation (stateless, no API key). Docs content only — no signaling-server source, no credentials. Setup: https://dendri.dev/docs/ai/. ## Server - Rust crate `dendri` (single-binary signaling server). AGPL-3.0-only with commercial dual-license available. - Axum + Tokio. Redis backend (default `redis://127.0.0.1:6379`, override with `--redis-url`). - Routes: `GET /health`, `GET /metrics`, `GET /{base}/`, `GET /{base}/:key/id|/peers|/turn-credentials`, `GET /{base}/dendri` (WebSocket upgrade), `GET /{base}/http/sse`, `POST /{base}/http/send`, `GET /{base}/http/poll`. - TLS via `--sslkey` + `--sslcert`. TURN credential minting via `--turn_secret`. JWT auth via `--jwt_secret`. ## Architecture highlights - **Four-tier connectivity fallback**: direct WebRTC P2P → STUN → TURN → end-to-end encrypted TLS relay through the signaling server. Signaling itself falls back WebSocket → SSE → HTTP long-poll. - **Rooms with host migration**: star-topology rooms; the first peer becomes host, and if the host disconnects a deterministic election promotes a new one. - **Typed presence**: per-peer state (cursor, selection, identity) broadcast and kept in sync across the room. - **Topics + RPC with ACK delivery**: pub/sub channels inside a room, plus typed request/response calls between peers with delivery guarantees. - **Relay E2E encryption**: when a P2P path is impossible, the server relays ECDH + AES-256-GCM encrypted blobs it cannot read. - **Yjs CRDT support**: `@afterrealism/dendri-y` exposes standard `y-protocols` sync semantics over a Dendri room (reserved `__yjs` topic). ## Comparisons - **Liveblocks, PartyKit**: hosted SaaS platforms. Dendri is self-host-first with an optional hosted tier. - **Hocuspocus**: self-hosted Yjs server. Dendri is also self-hostable but transport-agnostic and not Yjs-only — it supports presence, typed RPC, and Yjs sync over the same room abstraction with WebRTC P2P as the primary transport. - **PeerJS / simple-peer / Trystero**: lower-level WebRTC helpers. Dendri provides a higher-level signaling and collaboration layer above them. ## Licensing - TypeScript SDK packages (`@afterrealism/dendri-client`, `@afterrealism/dendri-y`): Apache-2.0. - Rust signaling server (`dendri`): AGPL-3.0-only. Commercial dual-license available for closed-source deployments — see `LICENSING.md` and `LICENSE-COMMERCIAL.md` in the server repo. - Don't pull AGPL code into the Apache-2.0 client packages; don't pull non-AGPL-compatible deps into the server. ## Optional - [Examples gallery (GitHub)](https://github.com/afterrealism/dendri-examples): chat, collaborative-edit, collaborative-layers, cursors, file-transfer, game, presence, react-basic, video-chat, vue-basic, whiteboard. - Live demos: every example runs against the production stack at `https://.dendri.dev/` — e.g. [chat.dendri.dev](https://chat.dendri.dev/), [cursors.dendri.dev](https://cursors.dendri.dev/), [game.dendri.dev](https://game.dendri.dev/). Open one in two tabs to see the P2P sync. - [Deploy scaffolding](https://github.com/afterrealism/dendri-infrastructure): Podman Quadlet + Terraform (`dendri-infrastructure`).