Mock Adapter

The MockAdapter stores everything in memory. Perfect for frontend development, unit tests, prototyping, and this playground.

Setup

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

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

Seeding data

adapter.seed('users', [
  { id: 1, name: 'Alice', age: 30, status: 'active' },
  { id: 2, name: 'Bob', age: 25, status: 'inactive' },
]);

Registering RPC functions

adapter.registerRpc('add', (args) => args.a + args.b);
adapter.registerRpc('greet', (args) => `Hello, ${args.name}!`);

Resetting state

adapter.reset(); // Clears all tables, RPCs, auth, storage, realtime

Features

  • Full CRUD with in-memory filter/sort/paginate engine
  • Auto-generated IDs for inserts without explicit id
  • Auth with in-memory user store (sign up, sign in, sessions)
  • Storage with in-memory file store (buckets, upload, download)
  • Realtime via EventEmitter (auto-fires on CRUD operations)
  • .or() filter parsing (PostgREST syntax)
  • .single() / .maybeSingle() semantics matching Supabase