What the server SDK is for
The server SDK is a small class — TadaServer, in lib/tada-server.js — that talks straight to the Tadabase Domain API from inside your backend routes (routes/*.js). Use it when custom server logic has to run before or after a data call: combining tables, guarding a call with a secret, or shaping a response. For plain reads and writes from the UI, the browser SDK is richer and easier.
import { TadaServer } from '../lib/tada-server.js';
const tada = TadaServer.fromEnv(); // reads TADA_API_BASE_URL
if (!tada.configured) throw new Error('App not bound to a Tadabase backend'); Acting as the signed-in user
Every data method takes the end-user's bearer token as its first argument. Pass it and RLS is enforced as that user — the same rules as everywhere else. Omit it only for genuinely public endpoints.
Methods
| Method | Purpose |
|---|---|
| request(path, { method, token, body, query }) | Low-level call. Returns { status, body }. Everything else builds on this. |
| login(username, password) | Exchange credentials for a bearer token. |
| listTables(token) | List the tables the user can reach (GET /data). |
| listRecords(token, slug, query) | List records from one table — paginated, RLS-enforced. |
| triggerWorkflow(token, workflowId, recordId, runMode) | Run a workflow on a record. |
| uploadFile(token, { bytes, name, type, fieldId, fieldSlug, recordId }) | Upload a file and optionally attach it to a record field. |
| getFile(token, fileId) | File metadata plus a fresh download URL. |