Prisma IDB FaviconPrisma IDB

Prisma 8 IDB

A typed IndexedDB client for Prisma 8, with migrations and optional sync

Prisma 8 IDB stores your app's data in the browser's IndexedDB, using a Prisma schema you already know how to write. It's in preview.

You describe your models in a .prisma file. The prisma CLI turns the schema into a typed contract. A second CLI, prisma-idb, plans migrations and bundles them into your app. In the browser, the client applies any pending migrations when it opens the database, then gives you typed queries:

const db = await getDb();

await db.orm.todo.create({ id: crypto.randomUUID(), title: "Write docs", done: false, userId });
const open = await db.orm.todo.where({ done: false }).orderBy({ title: "asc" }).all();

What you get

  • Your schema, in the browser. Models, relations, @id, @unique, @@index and @default map onto IndexedDB object stores and indexes.
  • Typed, chainable queries. where, orderBy, include, aggregate and friends. The API is chained calls, not Prisma Client's single argument object.
  • Relations enforced like a SQL database. Foreign keys are checked on every write, and onDelete and onUpdate actions run in the same transaction.
  • Reviewed migrations. Schema changes are planned on your machine, committed, and applied in each user's browser the next time the app opens.
  • Optional sync. Two packages keep IndexedDB and a server database in step, per user.

How it fits together

StepWhere it runsWhat happens
Write schema.prismaYour editorYou describe your models.
Emit the contractCLIprisma contract emit writes contract.json and its types.
Plan a migrationCLIprisma-idb migration plan writes a migration package you commit.
Bundle migrationsCLIprisma-idb migration contract-space writes a module your app imports.
Open the databaseBrowserThe client applies pending migrations, then you query.

Where to go next

On this page