npm install @rebasepro/client

Client SDK

One client. Full typed access to your data, auth, storage, and realtime — from any JavaScript or TypeScript environment.

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

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", "eq", "published")
  .where("views", "gte", 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", "eq", "published")
  .listen(({ data }) => {
    console.log("Live update:", data);
  });
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");
@rebasepro/sdk_generator

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.

$ npm install @rebasepro/client
$ rebase generate-sdk