The backend/Client SDK

One client.
Typed from your schema.

Data, auth, storage, realtime and your own functions — from any JavaScript or TypeScript environment, with collection names and field types checked at compile time.

Fully Typed

One Client, Everything You Need

createRebaseClient gives you typed access to data, auth, admin, and storage via a single instance. Generate types with rebase generate-sdk for full IntelliSense.

import { createRebaseClient } from "@rebasepro/client";
import type { Database } from "./database.types";

const rebase = createRebaseClient<Database>({
  baseUrl: "https://api.myapp.com",
});

// Everything is dot-accessible:
rebase.data      // → collection queries
rebase.auth      // → sign in, sign up, sessions
rebase.admin     // → user/role management
rebase.storage   // → file upload/download
rebase.realtime  // → broadcast channels, presence

Proxy-Based Data Access

Access any collection as a typed property. No string lookups, no manual typing — just rebase.data.posts.

CRUD Operations
// Find all published posts
const { data } = await rebase.data.posts.find({
  limit: 20,
  orderBy: "createdAt:desc"
});

// Get single post
const post = await rebase.data.posts
  .findById("abc-123");

// Create
await rebase.data.posts.create({
  title: "Hello World",
  status: "draft"
});

// Update
await rebase.data.posts.update("abc-123", {
  status: "published"
});

// Delete
await rebase.data.posts.delete("abc-123");
Fluent Query Builder
// Chained queries
const { data } = await rebase.data.posts
  .where("status", "==", "published")
  .where("views", ">=", 100)
  .orderBy("createdAt", "desc")
  .limit(10)
  .find();

// Include relations
const { data: posts } = await rebase.data.posts
  .include("author", "tags")
  .find();

// Full-text search
const results = await rebase.data.posts
  .search("rebase tutorial")
  .limit(5)
  .find();

// Realtime listening
const unsub = rebase.data.posts
  .where("status", "==", "published")
  .listen(({ data }) => {
    console.log("Live update:", data);
  });

// Broadcast channel
const channel = rebase.realtime.channel("chat-room");

channel.onBroadcast("message", (payload) => {
  console.log("Received:", payload);
});

await channel.join();
rebase.auth

Built-in Auth Client

Full auth lifecycle — sign in, sign up, Google OAuth, token refresh, password reset, email verification, and session management. Works in browser and Node.js.

// Sign in
await rebase.auth.signInWithEmail(
  "user@app.com", "password"
);

// Google OAuth
await rebase.auth.signInWithGoogle(idToken);

// Listen for auth changes
rebase.auth.onAuthStateChange((event, session) => {
  console.log(event, session?.user);
});

// Session management
const sessions = await rebase.auth.getSessions();
await rebase.auth.revokeSession(sessionId);
rebase.admin + rebase.storage

Admin & Storage

Manage users, roles, and files programmatically — no admin UI required.

// User management
const { users } = await rebase.admin.listUsers();
await rebase.admin.createUser({
  email: "new@app.com",
  roles: ["editor"]
});

// Role management
const { roles } = await rebase.admin.listRoles();

// File storage
await rebase.storage.uploadFile({
  file: myFile,
  path: "uploads/avatar.jpg"
});

const { url } = await rebase.storage
  .getDownloadURL("uploads/avatar.jpg");

await rebase.storage.deleteFile("old.pdf");
rebase generate-sdk

Generated Types

Run rebase generate-sdk to produce a database.types.ts file from your collection definitions. Pass it as a generic to createRebaseClient<Database> for full end-to-end type safety.

  • Auto-generated from your collection definitions
  • Full IntelliSense for rebase.data.<collection>
  • Property types, enums, and relations included
  • Regenerate on schema changes with one command
$ rebase generate-sdk
 Generated database.types.ts

// database.types.ts (auto-generated)
export interface Database {
  posts: {
    id: string;
    title: string;
    status: "draft" | "published";
    authorId: string;
    createdAt: Date;
  };
  users: {
    id: string;
    email: string;
    displayName: string | null;
  };
}

Start building with the SDK

Install, connect, query — in under 30 seconds.

$ pnpm add @rebasepro/client
$ rebase generate-sdk

Typed from your own schema.

Scaffold a project and the client is generated from the collections you define. No hand-written types to drift.

~pnpm dlx @rebasepro/cli init