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.
What a project gives you
Section titled “What a project gives you”- 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/clientfor TypeScript and JavaScript, and thevaifcommand-line tool.
Your team signs in to the console with email, social sign-in, or single sign-on with OpenID Connect.
Where your data lives
Section titled “Where your data lives”Projects use a shared, managed database by default. Plans that include one can move a project to a dedicated database.
Your first steps
Section titled “Your first steps”- Create an account in the console.
- Create a project and add a table.
- Copy the project ID and the publishable key from Security > Credentials.
- 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 rowsconst { data: posts } = await vaif.from("posts").orderBy("created_at", "desc").limit(10).list();console.log(posts);
// Get new rows as they are writtenvaif .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.