Capsule API
Server (lakebed/server)
import {
capsule, query, mutation, endpoint,
table, string, boolean, number, json, text
} from "lakebed/server";
Context
ctx.auth.user— current userctx.db— databasectx.env— env vars from.env.lakebed.native.serverctx.log— log buffer
DB
ctx.db.table("todos")
.where("userId", userId)
.orderBy("title", "asc")
.limit(10)
.all()
ctx.db.table("todos").get(id)
ctx.db.table("todos").insert({ ... })
ctx.db.table("todos").update(id, patch)
ctx.db.table("todos").delete(id)
Client (lakebed-native/client)
import { useAuth, useQuery, useMutation, signInWithGoogle, signOut, configureClient } from "lakebed-native/client";
Configure server URL in shell bootstrap or manually:
configureClient({ serverUrl: "http://localhost:3000" });