ichibaseichibase

Database

Query and mutate your Postgres tables through a chainable, fully-typed builder (PostgREST under the hood). Mongo projects get a parallel document API.

Querying

// Select with filters, ordering, pagination
const { data } = await ichi
  .from('posts')
  .select('id, title, author')
  .eq('published', true)
  .order('created_at', { ascending: false })
  .limit(20);

// One row
const { data: post } = await ichi.from('posts').select('*').eq('id', 1).single();

Insert, update, delete

await ichi.from('posts').insert({ title: 'Hello' });
await ichi.from('posts').update({ title: 'Edited' }).eq('id', 1);
await ichi.from('posts').delete().eq('id', 1);

// Call a Postgres function
const { data } = await ichi.rpc('search_posts', { q: 'hello' });

Mongo

await ichi.mongo.collection('orders').insertOne({ total: 42 });
const docs = await ichi.mongo.collection('orders').find({ total: { $gt: 10 } });
Security: the anon key only sees what your row-level security policies allow. A table with RLS disabled — or enabled with no matching policy — is open to anyone with the anon key. Enable RLS on everything you expose to clients.