Playground & Docs
createClient(url, key, options)| Parameter | Type | Description |
|---|---|---|
url | string | Backend URL (ignored by MockAdapter) |
key | string | API key (ignored by MockAdapter) |
options.adapter | DatabaseAdapter | The adapter instance |
import { createClient } from '@vibecode-db/client';
import { MockAdapter } from '@vibecode-db/client/adapters/mock';
const client = createClient('', '', {
adapter: new MockAdapter()
});
The client exposes the following properties and methods:
| API | Description |
|---|---|
client.from(table) | Start a query on a table |
client.rpc(fn, args) | Call a server-side function |
client.auth | Authentication operations |
client.storage | File storage (buckets & files) |
client.realtime | Realtime subscriptions |
client.channel(name) | Shorthand for realtime channel |
client.functions | Edge function invocations |
All query methods return chainable builders:
const { data, error } = await client
.from('users') // returns QueryBuilderSelect
.select('id, name') // returns TransformBuilder
.eq('status', 'active') // returns TransformBuilder (FilterBuilder)
.order('name') // returns TransformBuilder
.limit(10); // returns TransformBuilder
// await triggers execution via adapter