reference

SDK Reference

Complete reference for the postbasejs client SDK — installation, client setup, and all available methods.

Published: March 22, 2026Updated: March 22, 2026

SDK Reference

postbasejs is the official JavaScript/TypeScript client SDK for Postbase. It ships as a dual CJS + ESM package with full TypeScript definitions.

Installation

npm install postbasejs
# or
pnpm add postbasejs

Create a Client

import { createClient } from 'postbasejs'

const postbase = createClient(
  'https://your-postbase.com',
  'pb_anon_...'
)

Quick Examples

// Query
const { data, error } = await postbase
  .from('posts')
  .select('*')
  .order('created_at', { ascending: false })

// Auth
await postbase.auth.signInWithPassword({ email, password })
const { data: { user } } = await postbase.auth.getUser()

// Storage
await postbase.storage.from('avatars').upload('user.png', file)
const { data } = postbase.storage.from('avatars').getPublicUrl('user.png')

// RPC
const { data } = await postbase.rpc('my_function', { arg: 'value' })

Package Exports

  • postbasejs → main client entry point

  • postbasejs/ssr → SSR subpackage with cookie-based session handling