{"id":48235,"library":"js-bao-wss-client","title":"js-bao-wss-client","description":"A TypeScript/JavaScript client library (v2.0.1) for the js-bao-wss Yjs WebSocket service, providing document management, real-time collaborative editing, authentication (OAuth, magic link, OTP, passkey), permissions, invitations, blob storage, LLM chat, workflows, analytics, and offline support with automatic reconnection and storage fallback (IndexedDB in browsers, SQLite or in-memory in Node.js). Built for multi-tenant collaboration with Yjs CRDT and integrates with lib0, yjs, js-bao, better-sqlite3, y-sqlite3, and React. Released under MIT license.","status":"active","version":"2.0.1","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","yjs","websocket","cloudflare","crdt","collaboration","typescript"],"install":[{"cmd":"npm install js-bao-wss-client","lang":"bash","label":"npm"},{"cmd":"yarn add js-bao-wss-client","lang":"bash","label":"yarn"},{"cmd":"pnpm add js-bao-wss-client","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core CRDT library for collaborative document sync","package":"yjs","optional":false},{"reason":"Utility library required by yjs","package":"lib0","optional":false},{"reason":"Backend service dependency for API interactions","package":"js-bao","optional":false},{"reason":"Required for persistent storage in Node.js environments","package":"better-sqlite3","optional":true},{"reason":"SQLite binding for Yjs document persistence","package":"y-sqlite3","optional":true},{"reason":"Optional React integration (peer dependency)","package":"react","optional":true}],"imports":[{"note":"Default export is not available; must use named import. The function is async and returns a client instance.","wrong":"import initializeClient from 'js-bao-wss-client'","symbol":"initializeClient","correct":"import { initializeClient } from 'js-bao-wss-client'"},{"note":"CommonJS require is deprecated since v2.0.0; ESM is the primary module system.","wrong":"const JsBaoClient = require('js-bao-wss-client').JsBaoClient","symbol":"JsBaoClient","correct":"import { JsBaoClient } from 'js-bao-wss-client'"},{"note":"ClientOptions is a TypeScript type; use import type for isolated type imports.","wrong":"import { ClientOptions } from 'js-bao-wss-client'","symbol":"ClientOptions","correct":"import type { ClientOptions } from 'js-bao-wss-client'"}],"quickstart":{"code":"import { initializeClient } from 'js-bao-wss-client';\nimport * as Y from 'yjs';\n\nasync function main() {\n  const apiKey = process.env.JSBAO_API_KEY ?? 'your-api-key';\n  const client = await initializeClient({\n    appId: 'your-app-id',\n    apiKey,\n    auth: {\n      type: 'oauth',\n      tokenUrl: 'https://example.com/oauth/token',\n      clientId: 'your-client-id',\n    },\n    storageConfig: { type: 'memory' }, // optional\n  });\n\n  // Create a document\n  const docId = await client.documents.create({ name: 'My Doc' });\n  console.log('Created doc:', docId);\n\n  // Open document for real-time collaboration\n  const ydoc = new Y.Doc();\n  const provider = await client.open(ydoc, docId);\n  ydoc.getArray('content').insert(0, ['Hello, world!']);\n\n  // Clean up\n  provider.disconnect();\n  ydoc.destroy();\n}\n\nmain().catch(console.error);","lang":"typescript","description":"Initialize the client with OAuth, create a document, and open it for real-time collaboration using Yjs."},"warnings":[{"fix":"Use await initializeClient(...) and handle the promise.","message":"initializeClient is now async and returns a promise; previous sync signature removed in v2.0.0","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use import statements instead of require().","message":"CommonJS require pattern is deprecated; ESM imports are required","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Install better-sqlite3 as a dependency and ensure it is available at runtime, or explicitly set storageConfig to 'memory' if volatility is acceptable.","message":"Storage auto-detection in Node.js will silently fall back to in-memory if better-sqlite3 is not installed, losing persistence","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use a persistent storage config (better-sqlite3 or IndexedDB) to retain auth state across restarts.","message":"Offline grants and auth tokens are stored in the storage provider; in-memory storage will lose them on restart","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Pass { includeRoot: true } to list documents method to include root documents.","message":"The 'includeRoot' option for listing documents is opt-in by default; root documents are hidden unless explicitly requested","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'analyt':41 'authent':28 'automat':46 'bao':3,15,77 'better':79 'better-sqlite3':78 'blob':36 'browser':53 'built':61 'chat':39 'client':5,8 'cloudflar':93 'collabor':26,66,95 'crdt':69,94 'document':21 'edit':27 'fallback':50 'in-memori':56 'indexeddb':51 'integr':71 'invit':35 'javascript':90 'js':2,14,76 'js-bao':75 'js-bao-wss':13 'js-bao-wss-client':1 'lib0':73 'librari':9 'licens':89 'link':31 'llm':38 'magic':30 'manag':22 'memori':58 'mit':88 'multi':64 'multi-ten':63 'node.js':60 'oauth':29 'offlin':43 'otp':32 'passkey':33 'permiss':34 'provid':20 'react':85 'real':24 'real-tim':23 'reconnect':47 'releas':86 'servic':19 'sqlite':54 'sqlite3':80,83 'storag':37,49 'support':44 'tenant':65 'time':25 'typescript':96 'typescript/javascript':7 'v2.0.1':10 'websocket':18,92 'workflow':40 'wss':4,16 'y':82 'y-sqlite3':81 'yjs':17,68,74,91","created_at":"2026-06-07T16:55:35.933943+00:00","updated_at":"2026-06-07T16:55:35.933943+00:00","problems":[{"fix":"Install better-sqlite3: npm install better-sqlite3, or force in-memory storage: storageConfig: { type: 'memory' }","cause":"better-sqlite3 is not installed but the client is running in Node.js and attempting to use SQLite storage","error":"Error: Cannot find module 'better-sqlite3'"},{"fix":"Change import to: import { initializeClient } from 'js-bao-wss-client'","cause":"Using default import instead of named import for initializeClient","error":"TypeError: (0 , js_bao_wss_client.initializeClient) is not a function"},{"fix":"Ensure await is used: const client = await initializeClient({...});","cause":"The client is not fully initialized when calling methods due to missing await on initializeClient","error":"Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'create')"},{"fix":"Install lib0: npm install lib0","cause":"Missing peer dependency lib0 is not installed","error":"Error: Could not resolve the requested dependency 'lib0'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"js-bao-wss-client","openapi_spec":null,"status_page":null,"smithery":null,"categories":["collaboration","realtime"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}