Install the SDK
@potalab/base is ESM only, has no runtime dependencies and runs in browsers, Node 22+, Deno and Bun. It needs fetch, and WebSocket for realtime.
npm install @potalab/basepnpm add @potalab/baseCreate one client and share it across your app:
import { createClient } from "@potalab/base"import type { Database } from "./database.types" // optional, see below
export const base = createClient<Database>({ url: "https://<your-project-url>", // from the dashboard key: "lb_pub_...", // publishable key})Typed queries
Section titled “Typed queries”Generate the Database type from your schema with the CLI:
potalab base gen types --db-url "$DATABASE_URL" -o src/database.types.tsTable names, columns, inserts, updates and RPC arguments are then checked by TypeScript. Without the generic, everything is any.
Framework packages
Section titled “Framework packages”- Next.js: browser, server and proxy helpers sharing the session through a cookie.
- React Native: secure session storage and AppState-aware refresh.
@potalab/base/react:useQueryanduseMutationhooks on top of the client cache.