import { createRebaseClient } from "@rebasepro/client";
const client = createRebaseClient<Database>({
baseUrl: "http://localhost:3001"
});
// Fully typed queries
const { data } = await client.data.products.find({
where: {
category: ["==", "Electronics"],
in_stock: ["==", true]
}
});
// Type-safe inserts
await client.data.products.create({
name: "Camera",
price: 299,
category: "Electronics"
});
// Realtime, over the same collection
const unsubscribe = client.data.products.listen(
{ where: { in_stock: ["==", true] } },
(res) => setRows(res.data)
);