@vibecode-db/client

A universal database SDK that provides a 1:1 Supabase-compatible API on the frontend, but delegates to swappable backend adapters.

Why?

Use the familiar Supabase DX while targeting any backend:

  • Mock - In-memory, perfect for dev & testing
  • Supabase - Passthrough to @supabase/supabase-js
  • PocketBase - Translates queries to PocketBase API
  • REST - Maps to conventional REST endpoints

How it works

User code:  client.from('users').select('*').eq('status', 'active')
               ↓
Query Builder:  Accumulates a QueryDescriptor object
               ↓
await / .then():  Dispatches descriptor to adapter
               ↓
Adapter:  Translates QueryDescriptor → backend-native calls

The query builder implements PromiseLike - chained methods build up a descriptor, execution happens only on await.

Quick Start

import { createClient } from '@vibecode-db/client';
import { MockAdapter } from '@vibecode-db/client/adapters/mock';

const adapter = new MockAdapter();
const client = createClient('', '', { adapter });

const { data, error } = await client
  .from('users')
  .select('*')
  .eq('status', 'active')
  .limit(10);

Try the examples in the sidebar to see it in action!