PocketBase Adapter

Translates @vibecode-db/client queries to PocketBase SDK calls, handling the API differences automatically.

Install peer dependency

npm install pocketbase

Setup

import { createClient } from '@vibecode-db/client';
import { PocketBaseAdapter } from '@vibecode-db/client/adapters/pocketbase';

const adapter = new PocketBaseAdapter({
  url: 'http://127.0.0.1:8090',
});

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

Using an existing PocketBase client

import PocketBase from 'pocketbase';

const pb = new PocketBase('http://127.0.0.1:8090');
const adapter = new PocketBaseAdapter({ client: pb });

Filter translation

Filters are automatically translated to PocketBase syntax:

@vibecode-db/clientPocketBase
.eq('name', 'Alice')name = "Alice"
.neq('status', 'banned')status != "banned"
.gt('age', 18)age > 18
.gte('age', 18)age >= 18
.like('name', '%ali%')name ~ "%ali%"
.is('deleted_at', null)deleted_at = null

Important notes

  • Update/Delete: PocketBase requires record IDs. The adapter first queries matching records, then applies mutations individually.
  • Storage: PocketBase uses file fields on records rather than a separate storage API. The storage adapter methods return "not supported" errors.