Skip to Content
🚀 KalamDB v0.3.0-alpha2 is out — Learn more
SDK & ClientSetup & Quick Start

Setup & Quick Start

Looking to use Rust instead of TypeScript/JavaScript?

Install

npm i kalam-link

Runtime requirements:

  • Node.js >= 18 (or modern browser)
  • running KalamDB server (http://localhost:8080 by default)

First client

import { createClient, Auth } from 'kalam-link'; const client = createClient({ url: 'http://localhost:8080', auth: Auth.basic('root', ''), });

Connect and query

await client.connect(); const result = await client.query('SELECT CURRENT_USER()'); console.log(result.status, result.results[0]);

Parameterized query

Use $1, $2, … placeholders:

const filtered = await client.query( 'SELECT * FROM app.messages WHERE conversation_id = $1 AND is_deleted = $2', ['conv_42', false], );

First live subscription

const unsubscribe = await client.subscribe('app.messages', (event) => { if (event.type === 'change') { console.log(event.change_type, event.rows); } }); // Later await unsubscribe(); await client.disconnect();

Optional WASM path override

In environments where auto-WASM resolution fails, pass wasmUrl:

const client = createClient({ url: 'http://localhost:8080', auth: Auth.basic('root', ''), wasmUrl: '/wasm/kalam_link_bg.wasm', });

Common startup pitfalls

  • connect() before query subscriptions is recommended (query alone initializes automatically).
  • If browser bundling cannot find WASM, provide wasmUrl explicitly.
  • For local dev auth, confirm server credentials and URL first.

Next

Last updated on