TypeScript client
Use the only TypeScript package that communicates directly with the FFDB HTTP API.
Connect a TypeScript application
The TypeScript client is the supported HTTP SDK package for auth, data, storage, sync, and administration.
It preserves tagged values, session rotation, stable errors, cancellation, and request conventions across runtimes.
Use it in browser, Node, React, or React Native code that talks directly to FFDB.
Requirements for TypeScript client
- Prerequisite — A ready FFDB origin and project ID.
- Prerequisite — The verified @ffdb/client SDK package from the release channel or private package registry.
- Required value — baseUrl, projectId, runtime session store, and optional fetch implementation.
- Required value — developerKey only for trusted server/operator tools; never for browser bundles.
Install and construct
Install @ffdb/client at the exact version named by the server release. Inspect npm only for discovery; do not float the production dependency range.
npm view @ffdb/client dist-tags --json
npm install --save-exact @ffdb/client@0.3.0
npm ls @ffdb/clientnpm install --save-exact ./@ffdb/client-0.3.0.tgzimport { BrowserSessionStore, FFDBClient } from "@ffdb/client";
export const ffdb = new FFDBClient({
baseUrl: "https://ffdb.example.com",
projectId: "your-project-id",
sessionStore: new BrowserSessionStore(
window.sessionStorage,
"my-app.ffdb-session",
),
});Public capabilities
- Developer queries, transactions, migrations, schema, and policies
- End-user registration, sessions, password reset, and token rotation
- Organizations, projects, API keys, settings, logs, and backups
- Storage upload/download signing and multipart lifecycle
- Logical snapshot, pull, and push
Generate IDs and cancel work
generateId uses crypto.randomUUID and accepts an optional prefix of at most 32 letters, numbers, underscores, or hyphens. Aborting rejects local request work; it does not imply that already-committed server work was rolled back.
import { generateId } from "@ffdb/client";
const controller = new AbortController();
const id = generateId("doc_");
const request = ffdb.query({
sql: "insert into documents (id, owner_id, title) values (?1, auth.uid(), ?2)",
parameters: [
{ type: "text", value: id },
{ type: "text", value: title },
],
}, { signal: controller.signal });
controller.abort();
await request;TypeScript client workflow
- 1. Install the version-matched SDK package.
- 2. Construct FFDBClient with runtime-safe configuration.
- 3. Sign in an end user or configure trusted administration.
- 4. Issue a parameterized request with an optional AbortSignal.
- 5. Handle FFDBError by code, status, and requestId.
Verify typescript client
The application communicates through the public API with typed request/response contracts and no raw database credential.
Troubleshoot typescript client
- The SDK version targets a different server contract — install the package set shipped for that release.
- A developer key appears in built assets — revoke it immediately and remove it from client configuration.
Continue from TypeScript client
- Add React providers or native stores.
- Generate project schema types with the CLI.