Overview
Get a first glimpse of how to set Jazz up and how to use it from the server and clients.Jazz is a relational database that runs inside your backend, with real-time queries and permissions built in. Query and update data from your server or directly from your frontend, using a thin client or a local-first client for offline support.
Every Jazz app is defined first by its database schema and permission policies. You write both in TypeScript, in schema.ts.
schema.tsimport { schema as s } from "jazz-tools";export const schema = s.defineSchema({todos: s.table({title: s.string(),done: s.boolean(),}),});const { definePermissions, session } = schema;// Each user sees and edits only the todos they createdconst createdByMe = { $createdBy: session.user };export const permissions = definePermissions({todos: {read: createdByMe,insert: createdByMe,update: createdByMe,delete: createdByMe,},});
Run npx jazz-tools generate after writing it, and again after each change. It checks the schema
and permissions and writes jazz.app.json, jazz.permissions.json and jazz.generated.ts, the
typed app your code imports. Commit all of them. See Defining Tables.
Jazz runs inside your backend: no separate database server and no deploy step. The schema and permissions your backend imports are the ones it enforces.
server.tsimport { Hono } from "hono";import { createJazz, sqlite } from "jazz-tools/backend";import { app } from "./jazz.generated";import permissions from "./jazz.permissions.json" with { type: "json" };const jazz = createJazz({app,permissions,store: sqlite({ path: "./data/jazz" }),authenticate: async (request) => getSignedInUser(request), // your own auth: { userId, expiresAt } or null});new Hono()// Runs with backend authority and sees every todo (check admin access in your app first).get("/admin/todos", async (c) => {return c.json(await jazz.db.all(app.todos));})// Runs as the signed-in user: the query only returns their own todos.get("/todos", async (c) => {const db = await jazz.forReqUser(c.req.raw);return c.json(await db.all(app.todos.where({ done: false })));})// Sync for browsers, on your own origin.all("/jazz/*", (c) => jazz.handle(c.req.raw));
You can also query and write to the database right from your frontend. It is protected by the same auth as your backend, and the same permission policies apply. Pick a thin client (about 160 KB gzipped) or a full local-first client (its Wasm engine adds about 4 MB gzipped).
client.tsimport { createJazzClient } from "jazz-tools/client";import { app } from "./jazz.generated";// Asks your backend's /jazz route who is signed in, with your app's own session cookieconst session = await createJazzClient({ serverUrl: "/jazz" });const db = session.db; // the signed-in user's Db// Live query: updates as soon as the server (or anyone else) changes a tododb.subscribe(app.todos.where({ done: false }), (todos) => {console.log(todos);});
Todos.tsximport { useAll } from "jazz-tools/react";import { app } from "./jazz.generated";export function Todos() {const { data: todos = [], db } = useAll(app.todos.where({ done: false }));return todos.map((todo) => (<label key={todo.id}><input type="checkbox" onChange={() => db.update(app.todos, todo.id, { done: true })} />{todo.title}</label>));}
App.tsximport { JazzProvider } from "jazz-tools/react";// Connects to /jazz on your backend, signed in as your app's current user<JazzProvider config={{ serverUrl: "/jazz" }}><Todos /></JazzProvider>;
Todos.vue<script setup lang="ts">import { useAll } from "jazz-tools/vue";import { app } from "./jazz.generated";const { data: todos, db } = useAll(app.todos.where({ done: false }));</script><template><label v-for="todo in todos ?? []" :key="todo.id"><input type="checkbox" @change="db.update(app.todos, todo.id, { done: true })" />{{ todo.title }}</label></template>
App.vue<script setup lang="ts">import { JazzProvider } from "jazz-tools/vue";</script><template><!-- Connects to /jazz on your backend, signed in as your app's current user --><JazzProvider :config="{ serverUrl: '/jazz' }"><Todos /></JazzProvider></template>
Todos.svelte<script lang="ts">import { QuerySubscription } from "jazz-tools/svelte";import { app } from "./jazz.generated";const todos = new QuerySubscription(app.todos.where({ done: false }));</script>{#each todos.current ?? [] as todo (todo.id)}<label><input type="checkbox" onchange={() => todos.db.update(app.todos, todo.id, { done: true })} />{todo.title}</label>{/each}
App.svelte<script lang="ts">import { JazzProvider } from "jazz-tools/svelte";</script><!-- Connects to /jazz on your backend, signed in as your app's current user --><JazzProvider config={{ serverUrl: "/jazz" }}><Todos /></JazzProvider>
Todos.tsximport { For } from "solid-js";import { useAll } from "jazz-tools/solid";import { app } from "./jazz.generated";export function Todos() {const todos = useAll(() => ({ query: app.todos.where({ done: false }) }));return (<For each={todos.data ?? []}>{(todo) => (<label><input type="checkbox" onChange={() => todos.db.update(app.todos, todo.id, { done: true })} />{todo.title}</label>)}</For>);}
App.tsximport { JazzProvider } from "jazz-tools/solid";// Connects to /jazz on your backend, signed in as your app's current user<JazzProvider config={{ serverUrl: "/jazz" }}><Todos /></JazzProvider>;
todos.tsimport { Effect, Stream } from "effect";import { Jazz } from "jazz-tools/effect";import { app } from "./jazz.generated";const program = Effect.gen(function* () {const jazz = yield* Jazz;// Live query as a Stream: a full snapshot on start and on every changeyield* jazz.stream(app.todos.where({ done: false })).pipe(Stream.runForEach((todos) => Effect.log(todos)));});// Same config as createJazzClient(): asks /jazz who is signed in, with your session cookieprogram.pipe(Effect.provide(Jazz.layer({ serverUrl: "/jazz" })), Effect.runPromise);
App.swift// An end user's client syncs through your app's Jazz endpoint (its// backend's handler). Sign in with a device account, whose key you// keep in the keychain, or with your own sign-in's bearer token.let auth: Jazz.Auth =if let deviceKey {.deviceKey(deviceKey) // from Jazz.generateDeviceKey()} else {.bearer { _ in try await MySignIn.currentToken() }}let jazz = try await JazzApp.open(.client(appId: appId, serverUrl: endpoint, auth: auth, storage: .memory))for try await state in jazz.session {if case .signedIn(let user) = state {print("signed in as", user.account)break}}
App.swiftpublic func watchOpenTodos(_ jazz: Jazz.Client, onChange: @escaping @Sendable ([JazzApp.Todo]) -> Void) -> Task<Void, any Error> {// `watch` yields the whole result each time it changes (`subscribe`// yields deltas instead). Cancel the task to unsubscribe.Task {for try await todos in jazz.watch(JazzApp.todos.query().where(JazzApp.todos.done.eq(false))) {onChange(todos)}}}
App.kt// An end user's app: it syncs through your backend's Jazz endpoint, signed in// with a device account (keep the key in the platform keychain).val jazz = jazzapp.open(JazzConfig(appId = appId,serverUrl = endpoint, // e.g. "https://app.example/jazz"storage = Storage.Persistent,dataDir = System.getProperty("java.io.tmpdir") + "/stage-plan-" + appId,auth = JazzAuth.DeviceAccount(deviceKey), // JazzAuth.generateDeviceKey() once),)
App.kt// Collecting the flow subscribes, and each change brings the whole result.// Cancel the returned job to unsubscribe.fun subscribeOpenTodos(scope: CoroutineScope, jazz: Jazz, onChange: (List<Todo>) -> Unit): Job =scope.launch {jazz.watch(Todos.where(Todos.done eq false)).collect { todos -> onChange(todos) }}
Set up the client: Thin Client (the default) or Local-First Client (offline, instant UI).
Start here
What you'll learn, in order
- Setup — run locally, deploy to Vercel or your own server, add a backend, then a client
- Schemas & Policies — tables, column types, relationships, who can do what, and migrations
- Reading Data — queries, live subscriptions and framework hooks
- Writing Data — inserts, updates, transactions and mergeable text
- Operating Jazz — backups, upgrades, monitoring and scaling
- Tooling — CLI, MCP, inspector and testing
What people build with Jazz
- A backend with live data. Your API or server components read from and write to Jazz directly, with permissions checked per user and live queries pushed to the browser. Path: Quickstart → User-scoped use → Declarative Permissions → Thin client.
- A collaborative app. Shared lists, boards or documents that several people edit at once, with mergeable text and edit history. Path: Mergeable text → Shared access → Edit metadata.
- An app that works offline. Field tools, note-taking or mobile apps that keep working without a connection. Path: start thin, then go local-first on the screens that need it, or use the React Native client.
- Agents and automations. Background jobs and AI agents that read and write the same data as your users, attributed and permission-checked. Path: Backend Client → How Auth Works → CLI & MCP.
- Drafts and review flows. Edit a copy, compare it with the original, merge it back. Path: Drafts & branches.
Recipes
- Access control: user-owned data, shared access, invite links, group permissions
- Auth providers: Better Auth, WorkOS, any other auth, Better Auth database adapter
- Data patterns: collaborative lists, collaborative text, nested data
- Architecture: local-first as a client optimization, drafts & branches, Effect
Examples and help
- Example apps, from a todo list to a multi-user music sequencer
- Ask on Discord or open an issue on GitHub