Skip to main content
Version: 0.3.36

JavaScript Client Overview

Reference for @raisindb/client, the TypeScript SDK for browsers and Node.js.

Installation

npm install @raisindb/client
# Node.js only: the WebSocket implementation is an optional peer dependency
npm install ws

The package ships ESM and CommonJS builds with type definitions, plus subpath exports @raisindb/client/react, @raisindb/client/svelte and @raisindb/client/vue.

Quick start

import { RaisinClient } from '@raisindb/client';

const client = new RaisinClient('ws://localhost:8080', { repository: 'myapp' });

await client.connect();
await client.authenticate({ username: 'admin', password: 'password' });

const db = client.database('myapp');
const ws = db.workspace('content');

The client connects to ws://host/ws/{repository}. Pass a bare host and the repository option, or the full path (ws://localhost:8080/ws/myapp). Multi-tenant operators can address a tenant with ws://host/sys/{tenant}/{repository}.

For server-side code without WebSocket, RaisinClient.forSSR(httpUrl) returns an HTTP-only client; see Connection & Authentication.

Reference pages