Skip to content

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.

Terminal window
npm install @potalab/base

Create 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
})

Generate the Database type from your schema with the CLI:

Terminal window
potalab base gen types --db-url "$DATABASE_URL" -o src/database.types.ts

Table names, columns, inserts, updates and RPC arguments are then checked by TypeScript. Without the generic, everything is any.

  • 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: useQuery and useMutation hooks on top of the client cache.