How it reaches your data
The browser SDK — imported as tada from src/lib/tada.ts — never calls Tadabase directly. It calls THIS app's own backend at /api/svc/*, which forwards to the Tadabase Domain API. That keeps custom logic and secrets server-side, and gives you offline queuing, automatic sign-out on expiry, and error surfacing for free.
The tada namespaces
| Namespace | What it does |
|---|---|
| tada.records | list / get / create / update / delete, plus filters, search, summaries, grouping, connected fields, subforms, and batch update/delete. |
| tada.me | The signed-in user's own profile (get / update) and a resolved RLS permissions report (what they can actually do). |
| tada.logs | Read the app's audit / activity streams — logins, sessions, record changes, emails, imports/exports, workflow runs. |
| tada.views | Read builder-defined saved views. |
| tada.workflows | Trigger a workflow (by record, loaded records, or matching conditions) and track its run. |
| tada.pdfs | Render a PDF Page or fill a PDF Form — url or base64. |
| tada.exports / tada.imports | Kick off and track CSV exports and imports. |
| tada.files | Upload files and fetch fresh download URLs. |
| tada.emails | Send builder-defined emails. |
| tada.sessions | Force-logout a user's active login sessions. |
| tada.aiPrompts | Run a builder-defined AI Prompt and get its generated fields back. |
| tada.notifications | Realtime updates from background jobs (imports/exports today) over a private per-user channel. |
useJson
The data hook. Give it an async function — usually a tada.* call, or a fetch to one of your own /api/* routes — and it returns SWR-style loading / error / data / refetch state.
const { data, error, isLoading, refetch } = useJson(() =>
tada.records.list('tickets', { limit: 25 }),
); Auth helpers
Beyond the login / signup / magic-link / password methods on tada, three helpers cover the common UI checks:
| Helper | Returns |
|---|---|
| tada.isAuthed() | true if a session token is present. |
| tada.user() | The signed-in user (with roles), or null. |
| tada.logout() | Revokes the token server-side, clears the local session. |
import { tada } from '@/lib/tada';
const user = tada.user();
if (!user) return <SignInPrompt />;
// user.roles → [{ name: 'Manager' }]