Skip to main content
The Chat SDK is plain TypeScript, so it works with any framework. The pattern is always the same: create one client, subscribe to its state, and call resume() once.

Vue

Svelte

Next.js and SSR

React Native

Node, Bun, and Deno

Electron and workers

For a full walkthrough, start with Getting started. The snippets below assume a shared client:
chat.ts

Vue

Wrap the state in a shallowRef. Each snapshot is immutable, so a shallow ref is enough:
useChat.ts

Svelte

subscribe already matches the store contract:
chat-store.ts
Call chat.resume() once, for example in onMount of your root component.

Next.js, Nuxt, SvelteKit, Remix, and Astro

Nothing touches window or storage at import time, and createClient does no work until you call a method. You can import the client on the server and call resume() and sendMessage() from client-side code only. In Next.js, mark components that use the chat with "use client".

React Native and Expo

There’s no localStorage, so pass AsyncStorage to keep the visitor’s session across app launches:
chat.ts
Use the same useSyncExternalStore hook as in Getting started, and render with FlatList and TextInput. To upload a file from a picker, pass its contents as a blob:

Node, Bun, and Deno

On a server, keep the session in memory. Each client is one visitor, so create one client per end user:
In Deno, import npm:@typewise/chat-sdk. Call chat.destroy() when the user’s session ends, to close the real-time connection.
Calls from a server arrive without a browser Origin header, so the Domain allowlist doesn’t apply to them.

Electron and Web Workers

Both work without changes. In a Web Worker, there’s no localStorage, so the SDK keeps the session in memory unless you pass your own storage adapter.

Compatibility