# Installing zaun-client

> Add zaun-client to a Rust project, or build its JavaScript/WebAssembly package for browsers, Node.js and Bun.

`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.

**JavaScript:**

The JavaScript package is the same Rust code compiled to WebAssembly, so you build it once:

```sh
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):

```sh
npm install /path/to/zaun-client/zaun
```

```js

```

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

**Rust:**

```toml title="Cargo.toml"
[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

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`.

## Next

[Connecting and joining](/docs/guide/client/connecting/).
