Initialize and use the PocketBase client
masterTo interact with your PocketBase instance, import the PocketBase class, instantiate it with your server URL, and use the collection API to perform operations like authentication and data retrieval.
Import Styles
ES Modules (Default):
import PocketBase from 'pocketbase'CommonJS:
const PocketBase = require('pocketbase/cjs')import PocketBase from 'pocketbase';
const pb = new PocketBase('http://127.0.0.1:8090');
// authenticate as auth collection record
const userData = await pb.collection('users').authWithPassword('test@example.com', '123456');
// list and filter "example" collection records
const result = await pb.collection('example').getList(1, 20, {
filter: 'status = true && created > "2022-08-01 10:00:00"'
});