Skip to content

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:

Terminal window
git clone https://github.com/zaunchat/zaun-client && cd zaun-client
rustup target add wasm32-unknown-unknown
cargo install wasm-bindgen-cli --version 0.2.130
scripts/build-zaun-js.sh # writes zaun/pkg/web and zaun/pkg/node

Then add it to your project (Node.js 22+, Bun, or a bundler for browsers):

Terminal window
npm install /path/to/zaun-client/zaun
import { Client, EmbedBuilder } from "zaun-client";

Node.js and Bun need werift for voice (npm install werift@0.27).

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.

Connecting and joining.