JavaScript / TypeScript SDK

Status: Implemented (Milestone 11) · Published on npm (Milestone 14)

Package: @bakend/client

Install

npm install @bakend/client

Workspace development (Bakend monorepo):

bun install

Quick start

import { BakendClient } from "@bakend/client";

const client = new BakendClient({ baseUrl: "http://localhost:8080" });

await client.auth.register({ email: "you@example.com", password: "password123" });
const posts = client.collection("posts");
const record = await posts.create({ title: "Hello" });

Modules

ModuleMethods
authregister, login, refresh, logout, getMe
collection(name)create, get, list, update, delete
storageupload, download, delete
realtimesubscribe, unsubscribe, disconnect (auto-reconnect)

Realtime

const unsub = client.realtime.subscribe("posts.*", (event) => {
  console.log(event.type, event.payload);
});

See also