Pick your app

The examples below will be updated with your app ID.

Working with data

Initializing Instant

The first step to using Instant in your app is to call init before rendering your component tree.

import { init } from '@instantdb/react';

// Visit https://instantdb.com/dash to get your APP_ID :)
const APP_ID = '__APP_ID__';

const db = init({ appId: APP_ID });

function App() {
  return <Main />;
}

If you're using TypeScript, init accepts a Schema generic, which will provide auto-completion and type-safety for useQuery results.

import { init } from '@instantdb/react';

// Visit https://instantdb.com/dash to get your APP_ID :)
const APP_ID = '__APP_ID__';

type MyAppSchema = {
  metrics: {
    name: string;
    description: string;
  };
  logs: {
    date: string;
    value: number;
    unit: string;
  };
};

const db = init<MyAppSchema>({ appId: APP_ID });

You'll now be able to use InstaQL and InstalML throughout your app!

Psst: Schema-as-code and type safety!

Instant now supports a CLI-based workflow, managing your schema as code, and strictly-typed queries and mutations. Give them a whirl and let us know what you think!