Framework-neutral
Use one shared createDendriStore() API across React, Vue, Svelte,
and vanilla apps.
Self-hosted by default
Dendri gives you a framework-neutral TypeScript SDK and a Rust signaling server for chat, presence, multiplayer state, Yjs documents, and relay-backed WebRTC.
$ npm install @afterrealism/dendri
$ cd server
$ cargo run -- --host 127.0.0.1 --port 9876 --enable_relay --allow_discovery
Use one shared createDendriStore() API across React, Vue, Svelte,
and vanilla apps.
No hidden hosted defaults. Your app always points to your own signaling server.
Power chat, presence, multiplayer state, and Yjs CRDT sync from the same room abstractions.
Local setup
cd server
cargo run -- --host 127.0.0.1 --port 9876 --enable_relay --allow_discovery
npm install @afterrealism/dendri
import { createDendriStore } from "@afterrealism/dendri";
const store = createDendriStore({
host: "127.0.0.1",
port: 9876,
secure: false,
path: "/",
});
store.join("project-room");
Task recipes
Publish and subscribe by topic for clean message routing.
const unsubChat = store.subscribe("chat", (data, peerId) => {
console.log("chat", peerId, data);
});
store.broadcast(
{ type: "chat", text: "hello team" },
{ topic: "chat" },
);
Sync user metadata and read all peers from snapshot state.
store.setPresence({
name: "Ari",
cursor: [314, 128],
color: "#67e8f9",
});
store.subscribe(() => {
const { presences } = store.getSnapshot();
console.log("presence map", presences);
});
Bridge Yjs updates over Dendri topics using
@afterrealism/y-dendri.
import { DendriYjsProvider } from "@afterrealism/y-dendri";
import * as Y from "yjs";
const doc = new Y.Doc();
const provider = new DendriYjsProvider({ room: store, doc });
store.join("shared-doc");
// cleanup: provider.destroy(); doc.destroy(); store.destroy();
Send chunks for assets or CRDT updates without JSON overhead.
const bytes = new Uint8Array([1, 2, 3, 4]);
store.broadcastBinary(bytes, { topic: "asset-chunk" });
store.subscribe("asset-chunk", (payload) => {
if (payload instanceof Uint8Array) {
console.log("binary bytes:", payload.byteLength);
}
});
Framework integrations
Vanilla JS integration
Validation and deployment
cd e2e
npm install
npm run test:examples-local
Runs Playwright against Svelte, React, and Vue example apps plus local signaling.
cd deploy
# compose assets for local/VM deployment
Use the deployment folder when you need a packaged service topology.
cd infrastruture/terraform
# Terraform modules for cloud rollout
Start from Terraform modules if you need managed infrastructure provisioning.