
Company News
Socket Joins New OpenJS Program to Fund Node.js Security Work
Socket is joining the OpenJS Security Stewardship Program to fund Node.js vulnerability research, maintainer remediation, and security releases.
@rebasepro/client
Advanced tools
HTTP SDK client for the Rebase backend — typed CRUD, auth, storage, realtime WebSockets, offline / local-first sync, admin, cron, and custom functions.
pnpm add @rebasepro/client
ESM-only: "type": "module" with no CommonJS build, so it is loaded with
import. It needs Node >=22.22.0 (its engines floor), where require()
of it resolves too: Node has supported require(esm) since 22.12.
@rebasepro/client is the primary SDK for interacting with a Rebase backend from any JavaScript/TypeScript environment (browser, Node.js, edge). It creates a single client instance that provides:
.where(), .orderBy(), .limit(), etc.)client.data.products auto-maps to the products collection| Export | Description |
|---|---|
createRebaseClient<DB>(options) | Create a client instance. Generic DB parameter enables type-safe client.data.* access. |
CreateRebaseClientResult<DB> | The client type it returns (RebaseClient<DB> from @rebasepro/types, narrowed) — includes auth, admin, cron, functions, storage, ws, data, call, and token management methods. |
CreateRebaseClientOptions | Extends RebaseClientConfig with auth, admin, and cron sub-configs. |
| Option | Type | Default | Description |
|---|---|---|---|
baseUrl | string | "" | Backend URL (e.g. http://localhost:3001) |
token | string | — | Static auth token |
apiPath | string | "/api" | API path prefix |
fetch | typeof fetch | globalThis.fetch | Custom fetch implementation |
onUnauthorized | () => Promise<boolean> | auto-refresh | Handler for 401 responses |
websocketUrl | string | derived from baseUrl | WebSocket URL for realtime |
realtime | boolean | true | Open the WebSocket — false lets a one-shot script exit |
collections | Record<string, string> | — | Maps accessor names to collection slugs |
offline | boolean | OfflineConfig | false | Local-first sync — see the docs |
client.data.collection("slug") or client.data.myCollection returns a CollectionClient<M>:
| Method | Description |
|---|---|
find(params?) | Query with pagination. Returns FindResult<M> ({ data, meta }, flat rows) |
findById(id) | Fetch a single row. Returns M | undefined |
create(data, id?) | Create a row. Returns M |
update(id, data) | Update a row. Returns M |
delete(id) | Delete a row |
count(params?) | Count matching rows |
where(col, op, val) | Start a fluent query — returns QueryBuilder |
orderBy(col, dir?) | Order results — returns QueryBuilder |
limit(n) / offset(n) | Pagination — returns QueryBuilder |
search(str) | Full-text search — returns QueryBuilder |
include(...rels) | Include related rows — returns QueryBuilder |
listen(params, onUpdate, onError?) | Realtime subscription (requires WebSocket) |
listenById(id, onUpdate, onError?) | Realtime single-row subscription |
observe(params, onResult, onError?, options?) | Live query — local-first when offline is on, otherwise fetch + listen |
observeById(id, onResult, onError?, options?) | Live query for a single row |
client.auth)| Method | Description |
|---|---|
signInWithEmail(email, password) | Email/password login |
signUp(email, password, displayName?) | Register new user |
signInWithGoogle(payload) | Google OAuth (ID token, access token, or auth code) |
signInWithOAuth(providerId, payload) | Generic OAuth for any provider |
signInWithGitHub/Microsoft/Apple/Facebook/Twitter/Discord/GitLab/Bitbucket/Slack/Spotify | Provider-specific convenience methods |
signOut() | Sign out and invalidate refresh token |
refreshSession() | Refresh the access token |
getUser() / updateUser(updates) | Current user profile |
resetPasswordForEmail(email) | Request password reset |
resetPassword(token, password) | Complete password reset |
changePassword(old, new) | Change password (authenticated) |
sendVerificationEmail() / verifyEmail(token) | Email verification |
getSessions() / revokeSession(id) / revokeAllSessions() | Session management |
getAuthConfig() | Fetch backend auth configuration |
getSession() | Get current session (sync) |
onAuthStateChange(callback) | Subscribe to auth events (SIGNED_IN, SIGNED_OUT, TOKEN_REFRESHED, USER_UPDATED) |
client.storage)| Method | Description |
|---|---|
putObject({ file, key, metadata, bucket }) | Upload a file |
getSignedUrl(key, bucket?) | Get download URL + metadata |
getObject(key, bucket?) | Download file as File object |
deleteObject(key, bucket?) | Delete a file |
listObjects(prefix, options?) | List files with optional pagination |
client.admin)| Method | Description |
|---|---|
listUsers() / listUsersPaginated(options?) | List all users |
getUser(userId) | Get a single user |
createUser(data) | Create a user |
updateUser(userId, data) | Update a user |
deleteUser(userId) | Delete a user |
bootstrap() | First-user bootstrap |
client.functions)| Method | Description |
|---|---|
invoke<T>(name, payload?, options?) | Call a custom backend function at /api/functions/{name} |
| Export | Description |
|---|---|
RebaseApiError | Error class with status, message, code, details |
RebaseWebSocketClient | WebSocket client for realtime subscriptions |
isOfflineError(error) | True when a read failed with no network and nothing cached |
MemoryOfflineStore | Reference OfflineStore; the IndexedDB one is wired automatically |
createCookieStorage(options?) | Cookie-based auth storage adapter |
createMemoryStorage() | In-memory auth storage adapter |
QueryBuilder | Fluent query builder (also re-exported from @rebasepro/common) |
FindResult, FindParams, User, … | Re-exported from @rebasepro/types |
import { createRebaseClient } from "@rebasepro/client";
// Without a type argument every row is `Record<string, unknown>`. Pass the
// `Database` type `rebase generate-sdk` writes — `createRebaseClient<Database>(…)`
// — and every row, filter and sort below is checked.
const client = createRebaseClient({
baseUrl: "http://localhost:3001",
});
// Auth
await client.auth.signInWithEmail("user@example.com", "password");
// CRUD
const { data: products } = await client.data.products.find({ limit: 10 });
const product = await client.data.products.create({ name: "Camera", price: 299 });
await client.data.products.update(42, { price: 249 });
await client.data.products.delete(42);
// Fluent queries
const { data: expensive } = await client.data.products
.where("price", ">=", 100)
.orderBy("price", "desc")
.limit(5)
.find();
// Custom function
const result = await client.functions.invoke("process-order", { orderId: "123" });
// Realtime
const unsubscribe = client.data.products.listen(
{ limit: 50 },
(response) => console.log("Update:", response.data)
);
@rebasepro/common — QueryBuilder, buildRebaseData, shared utilities@rebasepro/types — Entity, FindResult, CollectionAccessor, etc.@rebasepro/utils — toSnakeCase and other helpers@rebasepro/app — React hook adapter that wraps client.auth for CMS integrationFAQs
HTTP SDK client for the Rebase custom backend
The npm package @rebasepro/client receives a total of 661 weekly downloads. As such, @rebasepro/client popularity was classified as not popular.
We found that @rebasepro/client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Company News
Socket is joining the OpenJS Security Stewardship Program to fund Node.js vulnerability research, maintainer remediation, and security releases.

Security News
Two compromised GitHub Actions were re-enabled with malicious tags intact, exposing thousands of downstream repositories to Mini Shai-Hulud.

Research
/Security News
A malicious Firefox extension fetches its payload after installation to evade detection, steal Google session cookies, and automate account takeover.