Skip to content

Introduction to VAIF Studio

VAIF Studio is a backend for your app. Each project has a database with a generated REST API, sign-in for your app’s users, file storage, realtime updates and server-side functions, all managed from one console.

  • Database. Design tables in the console or with SQL migration files. Every table gets a REST data API, and row rules limit each user to their own rows.
  • Authentication. Email and password, magic links, social sign-in, authenticator-app two-factor sign-in, password reset and device sessions for your app’s users.
  • Realtime. Row-change subscriptions, broadcast messages and presence over one connection.
  • Storage. Buckets with access policies, signed URLs and large-file uploads that can resume.
  • Functions. Server-side code that runs on request, on a schedule or when rows change.
  • Verament. Describe what you want, and Verament generates schemas and functions for your project.
  • SDK and CLI. @vaifstudio/client for TypeScript and JavaScript, and the vaif command-line tool.

Your team signs in to the console with email, social sign-in, or single sign-on with OpenID Connect.

Projects use a shared, managed database by default. Plans that include one can move a project to a dedicated database.

  1. Create an account in the console.
  2. Create a project and add a table.
  3. Copy the project ID and the publishable key from Security > Credentials.
  4. Install the SDK and connect your app.
import { createVaifClient } from "@vaifstudio/client";
const vaif = createVaifClient({
baseUrl: "https://api.vaif.studio",
projectId: process.env.VAIF_PROJECT_ID,
apiKey: process.env.VAIF_PUBLISHABLE_KEY,
});
// Read rows
const { data: posts } = await vaif.from("posts").orderBy("created_at", "desc").limit(10).list();
console.log(posts);
// Get new rows as they are written
vaif
.from("posts")
.on("INSERT", (event) => console.log("new post", event.new))
.subscribe();

A request with no signed-in user can read posts only if the table has a public rule. Tables are closed to such requests by default.