Installing zaun-client
zaun-client is Zaun’s client library: objects that act for themselves (message.reply(...),
member.kick(...)) and named events (messageCreate, memberAdd). It is not
on crates.io or npm yet; you use it from Git.
The JavaScript package is the same Rust code compiled to WebAssembly, so you build it once:
git clone https://github.com/zaunchat/zaun-client && cd zaun-clientrustup target add wasm32-unknown-unknowncargo install wasm-bindgen-cli --version 0.2.130scripts/build-zaun-js.sh # writes zaun/pkg/web and zaun/pkg/nodeThen add it to your project (Node.js 22+, Bun, or a bundler for browsers):
npm install /path/to/zaun-client/zaunimport { Client, EmbedBuilder } from "zaun-client";Node.js and Bun need werift for voice (npm install werift@0.27).
[dependencies]zaun-client = { git = "https://github.com/zaunchat/zaun-client" }The crate needs Rust 1.95 or newer. Native builds link aws-lc (for voice’s DTLS
certificates), so a C compiler must be available.
Browsers need a tunnel
Section titled “Browsers need a tunnel”Browsers can’t open raw TCP connections, and SimpleX relays listen on TCP. The browser build
connects through a WebSocket tunnel that only pipes bytes: TLS runs inside the WebAssembly
client, pinned to the relay’s certificate fingerprint, so the tunnel only sees ciphertext. The
zaun-client repository’s worker/ is such a tunnel as a Cloudflare Worker; pass its URL as
tunnel to Client.start.