Prisma generator for IndexedDB

You already write Prisma on the server. Now write it in the browser.

A Prisma generator that creates a type-safe IndexedDB client with the API you already know — plus an optional sync engine that handles conflict resolution, ownership, and offline-first data for you.

The same API. Zero learning curve.

Even with the idb library, querying across relations means manual index lookups, joins in application code, and zero type safety:

findManyfindFirstfindUniquecreateupdatedeleteupsert+ relations, nested writes & more
idb (IndexedDB wrapper)
const db = await openDB("MyDB", 1);

const posts = await db.getAllFromIndex(
  "posts", "byAuthor", userId
);

const result = [];
for (const post of posts) {
  if (!post.published) continue;
  const comments = await db.getAllFromIndex(
    "comments", "byPost", post.id
  );
  result.push({ ...post, comments });
}

result.sort(
  (a, b) => b.createdAt - a.createdAt
);
// manual joins, no types, no filtering
Prisma IDB
const posts = await idb.post.findMany({
  where: {
    authorId: userId,
    published: true,
  },
  include: {
    comments: {
      orderBy: { createdAt: "desc" },
    },
  },
  orderBy: { createdAt: "desc" },
});

// Typed. Relations included.
// Filtering, sorting, nesting —
// all generated from your schema.

See it in action

A full-stack Kanban board with bidirectional sync. Go offline, make changes, come back — everything syncs across devices.

kanban.prisma-idb.dev
Outbox
Changelog
lastChangelogId:42

Offline edits → Outbox

The demo uses manual sync controls. In production, call worker.start() for fully automatic background sync.

Sync that's built in,
not bolted on.

Most IndexedDB wrappers stop at CRUD. Prisma IDB generates a full sync engine from your schema — wire up two endpoints and a sync worker, and it handles the rest.

Works Offline, Syncs Later

Mutations queue locally and push automatically with retry and batching when the network is back.

Built-in Authorization

Every record knows who owns it — authorization is built into your schema, not bolted on with middleware.

Conflict Resolution

When two devices edit the same record, the server decides. Pull operations are fast and predictable.

generator prismaIDB {
  provider   = "idb-client-generator"
  output     = "./prisma-idb"
  outboxSync = true
  rootModel  = "User"
}

Three steps to full sync. Full setup guide →

How does it compare?

There are great tools for client-side storage. Prisma IDB is built for teams already using Prisma who want the same API in the browser — with sync included.

FeaturePrisma IDBDexie.jsRxDBElectricSQL
Prisma-compatible API
Type-safe from schema
Relations & nested queries
Bidirectional sync
Conflict resolution
Offline-first
No vendor lock-in
Zero runtime config

Supported Partial Not included

Built for speed. Measured honestly.

Benchmarks run entirely in the browser — no server, no network. The numbers below come straight from the latest CI snapshot on main.

Loading latest benchmark snapshot…

Fetching the most recent CI run from the public benchmark feed.

Run benchmarks in your browser

Results vary by browser, device, and dataset. Run your own to see what to expect in your environment.

Up and running in three steps

Add the generator to an existing Prisma project — no config files, no runtime dependencies.

1

Install

pnpm add idb @prisma-idb/idb-client-generator -D
2

Add the generator to your schema.prisma

generator prismaIDB {
  provider = "idb-client-generator"
  output   = "./prisma-idb"
}
3

Generate

npx prisma generate

Open Source

Prisma IDB is free and open source. Contributions and feedback are welcome.

Star on GitHub

Prisma is a trademark of Prisma. Prisma IDB is an independent open-source project and is not affiliated with, endorsed by, or sponsored by Prisma.

© 2026 Prisma IDB