Examples

Patterns you can copy

Each example is a focused, runnable app showing one slice of Fakebase, written in Next.js here for concreteness. The kernel is server-only, so reads happen on the server and client writes go through your framework's API routes.

The server-read, route-write pattern

The Fakebase kernel is backed by Node built-ins (fs, crypto), so it must run on the server. Read in Server Components; have Client Components call Server Actions or Route Handlers for mutations. The live Playground wires up posts and auth this way — and shows the real { data, error } at every step.

app/posts/page.tsx
// Server Component — read directly from the kernel
import { supabase } from "@/lib/fakebase";

export default async function PostsPage() {
  const { data: posts } = await supabase
    .from("posts")
    .select("*")
    .order("created_at", { ascending: false });

  return <PostList posts={posts ?? []} />;
}

// Client writes go through a Route Handler:
//   app/api/posts/route.ts  ->  supabase.from("posts").insert(...)