Skip to content

Migrating from @vaiftech/client

@vaiftech/client is the SDK’s retired package name. @vaifstudio/client replaces it. If your app uses @vaif/client, the step is smaller: install @vaifstudio/client and change the imports, because the API is the same.

Terminal window
npm uninstall @vaiftech/client
Terminal window
npm install @vaifstudio/client
Terminal window
# macOS
grep -rl '@vaiftech/client' src | xargs sed -i '' 's|@vaiftech/client|@vaifstudio/client|g'
# Linux
grep -rl '@vaiftech/client' src | xargs sed -i 's|@vaiftech/client|@vaifstudio/client|g'

@vaifstudio/client has one constructor, createVaifClient, and no default export. Queries are chained and run with a final call such as list():

import { createVaifClient } from "@vaifstudio/client";
import { upload } from "@vaifstudio/client/storage";
const vaif = createVaifClient({
projectId: process.env.VAIF_PROJECT_ID,
apiKey: process.env.VAIF_PUBLISHABLE_KEY,
});
const { data: posts } = await vaif.from("posts").eq("published", true).limit(20).list();
const input = document.querySelector<HTMLInputElement>("#avatar")!;
await upload(vaif, "avatars", "users/42/avatar.png", input.files![0]);
console.log(posts.length);
  • Uploads are in @vaifstudio/client/storage, and browser helpers (file pickers and drop zones) in @vaifstudio/client/storage/browser.
  • Realtime is on the client: vaif.from(table).on(...) and vaif.channel(name). See Realtime.
  • vaif.auth.signUp signs up your app’s users and needs projectId. VAIF Studio accounts are created in the console.

Run your type checker (npx tsc --noEmit) and your tests. A method that moved or was renamed shows up as a type error.

Questions? Email support@vaif.studio.