@collab-kit/client package is a browser SDK. It connects to your server over WebSocket and provides modules for users, rooms, presence, stores, comments, broadcasts, file storage, and CRDT collaboration.
Installation
@collab-kit/utils is a peer dependency that provides shared types and the defineStores() utility. Install it alongside the client.Initialization
Constructor Options
Base HTTP(S) URL of your CollabKit server. The SDK automatically derives the WebSocket URL from this.
JWT token returned when creating a user via
POST /users. Contains the accountId, userId, and roomId.(Optional) You must pre-define store schemas with
defineStores(). during initialization. Each client instance has access to the stores that are passed to it during initialization.User Lifecycle
Step 1: join()
join() is the single entry point. It opens the WebSocket (if not already open), authenticates with the server using the JWT token, sets the current user as online, loads active editors, comments, and stores, and notifies other participants when this session is an editor. After
join() resolves:
client.users.activeis populated with active editors, excluding selfclient.users.allremains empty until you callclient.users.list(...)client.currentUserandclient.currentRoomare set- Comments and stores are hydrated
- Editors can write collaboration state; viewers receive updates and can follow users
Step 2: disconnect()
Modules
The client provides access to collaboration features through modules:Next Steps
Client SDK Reference
Full API reference for all SDK modules.
Guides & Examples
Build a cursor tracking experience and more.