SDKs & integrations

Web (JS) SDK

@orbitneststudio/js — the client-side SDK for web apps (React, Vue, Svelte, vanilla).

@orbitneststudio/js is the browser counterpart to @orbitneststudio/node — the same API, packaged for the browser (ESM, CJS, and a CDN bundle) with session persistence and no Node-only dependencies.

Install

bash
npm install @orbitneststudio/js

Or over a CDN — the global is OrbitNest:

html
<script src="https://cdn.jsdelivr.net/npm/@orbitneststudio/js"></script>
<script>
  const orbit = OrbitNest.createClient({ apiKey: 'YOUR_ANON_KEY' });
</script>

Use the anon key

In client-side code use your project's publishable anon key — never a service-role key (it bypasses RLS).

Create a client

typescript
import { createClient, localStorageAdapter } from '@orbitneststudio/js';

const orbit = createClient({
  apiKey: import.meta.env.VITE_ORBITNEST_ANON_KEY,
  storage: localStorageAdapter, // persist the session across reloads (default: in-memory)
});

Query

typescript
const { data, error } = await orbit.db
  .from('posts')
  .eq('published', true)
  .order('created_at', { ascending: false })
  .limit(10)
  .select();

The fluent builder is parameterized and shared with the Node/Flutter SDKs — including textSearch() and nearest() (pgvector). See Database.

Auth

typescript
await orbit.auth.signIn({ email, password });
const user = orbit.auth.getUser();

// Passkeys, TOTP MFA, and SMS OTP are all supported — see the Auth guide.
await orbit.auth.signInWithSms('+15555550123');

See Authentication for MFA, SMS, and passkeys.

Realtime & storage

typescript
const channel = orbit.channel('orders')
  .on('postgres_changes', { event: 'INSERT', table: 'orders' }, (e) => console.log(e.new))
  .subscribe();

await orbit.storage.from('avatars').upload('u/1.png', file);
const { data } = orbit.storage.from('avatars').getPublicUrl('u/1.png', {
  transform: { width: 128, format: 'webp' },
});

Errors

Every call returns { data, error } — check error first. Prefer exceptions? Use the exported unwrap(result) helper to throw instead.