supabase-client-wasm 0.2.2

WASM/TypeScript bindings for supabase-client-sdk
Documentation

supabase-client-wasm

WASM/TypeScript bindings for supabase-client-sdk.

Note: This crate is part of the supabase-client-sdk workspace. It provides #[wasm_bindgen] bindings for using the SDK from JavaScript/TypeScript. If you're building a Rust application targeting WASM, you can use supabase-client-sdk directly with all features.

Key Features

  • WasmSupabaseClient — main entry point with CRUD methods (from_select, from_insert, from_update, from_delete)
  • WasmAuthClient — sign up/in, sessions, OAuth, password reset
  • WasmRealtimeClient — WebSocket connect/disconnect
  • WasmStorageClient — bucket listing and retrieval
  • WasmFunctionsClient — edge function invocation
  • TypeScript declarations auto-generated by wasm-pack
  • All values cross the JS boundary as JSON via serde-wasm-bindgen

Building

# Install wasm-pack if needed
cargo install wasm-pack

# Build for browser <script type="module">
wasm-pack build crates/supabase-client-wasm --target web --out-dir ../../pkg

# Or for bundlers (webpack, vite, etc.)
wasm-pack build crates/supabase-client-wasm --target bundler --out-dir ../../pkg

Usage (JavaScript/TypeScript)

import init, { WasmSupabaseClient } from './pkg/supabase_client_wasm.js';

await init();

const client = new WasmSupabaseClient(
  'https://your-project.supabase.co',
  'your-anon-key'
);

// Query
const rows = await client.from_select('cities', '*');
console.log('Cities:', rows);

// Auth
const auth = client.auth();
const session = await auth.sign_in_with_password('user@example.com', 'password');

// Edge Functions
const functions = client.functions();
const result = await functions.invoke('hello', { name: 'World' });

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.