Skip to main content
Prisma Documentation Docs

Search documentation

Type to search this documentation.

On this pageOverview

Extensions (/docs/orm/extensions)

For the complete Prisma documentation index, see llms.txt. A markdown version of any docs page is available by appending .md to its URL.

Every package that plugs into Prisma ORM: database packages, column types, indexes, query operations, and middleware, by Prisma and the community.

Location: ORM > Extensions

An extension is an npm package that adds something Prisma ORM does not do on its own: a column type such as a vector or a geometry, an index type, query operations (new functions you can call in a query, such as pgvector's cosineDistance), or middleware, which runs your own code before and after every query. To use PostgreSQL you install @prisma/orm-postgres, and to use MongoDB you install @prisma/orm-mongo, because support for a database comes from an extension too.

Installing the package is not the whole job, because you register an extension in two places. It goes in prisma.config.ts, so that the command line tools know about it, and in db.ts, the file where you create the client, so that your queries can use what it adds. @prisma/orm-postgres is the package you call directly: ormConfig(...) in prisma.config.ts and postgres(...) in db.ts. Other extensions are listed in the extensions array passed to those two calls. Using extensions shows both registrations, with the install command, for pgvector. Middleware is the exception, because you register it on the client only, and How middleware works covers that.

Your contract is what Prisma ORM 8 calls your schema: contract.prisma in place of schema.prisma. If you have a Prisma ORM 7 project, Coming from Prisma ORM 7 says what replaced schema.prisma, @prisma/client, and $use.

The extension directory has the install command and the registration snippet for each entry below. There is no MySQL package, and Supported databases says what is planned. An entry marked experimental works today, but its API can change between releases.

Name What it adds Package Databases By
arktype-json JSON columns validated by an arktype schema and typed end to end. @prisma/orm-extension-arktype-json PostgreSQL Prisma
Cache middleware Serve repeated reads from an in-memory or pluggable cache, opted in per query. @prisma/orm-extension-middleware-cache PostgreSQL, MongoDB Prisma
MongoDB MongoDB support for Prisma ORM: config, runtime, contract authoring, BSON values, and migrations in one package. @prisma/orm-mongo MongoDB Prisma
ParadeDB (experimental) BM25 full-text search indexes. @prisma/orm-extension-paradedb PostgreSQL Prisma
pgvector Vector columns and similarity search for embeddings. @prisma/orm-extension-pgvector PostgreSQL Prisma
PostGIS Geometry columns and geospatial queries such as distance and containment. @prisma/orm-extension-postgis PostgreSQL Prisma
PostgreSQL PostgreSQL support for Prisma ORM: config, runtime, contract authoring, and migrations in one package. @prisma/orm-postgres PostgreSQL Prisma
SQLite (experimental) SQLite support for Prisma ORM: config, runtime, contract authoring, and migrations in one package. @prisma/orm-sqlite SQLite Prisma
Supabase (experimental) Supabase auth and storage tables plus role-bound clients for row-level security. @prisma/orm-extension-supabase PostgreSQL Prisma
IndexedDB (experimental) Prisma 8 for IndexedDB: a browser database from your PSL schema, with typed accessors and explicit migrations. @prisma-idb/client-idb IndexedDB Yash Kolekar
typed-json Typed JSON and text columns with no validator dependency. prisma-orm-extension-typed-json PostgreSQL Omar Dulaimi
zod-json Typed JSON columns described and enforced by a zod schema. prisma-orm-extension-zod-json PostgreSQL Omar Dulaimi

In the Supabase row, role-bound clients are client instances pinned to a particular PostgreSQL role, so the database applies that role's row-level security policies to whatever you query through them.

An extension you write yourself is an npm package with one entry point for the command line tools and one for your application. Name your two entry points control and runtime, as pgvector does and as the call for extension authors describes. Middleware ships a single entry point instead, because it is only ever registered on the client.

To write middleware, follow Authoring custom middleware. If you are adding a whole database, @prisma/orm-postgres is the one to copy for a SQL database and @prisma/orm-mongo for a document database. Once your package is on npm, submit it to the directory, and a maintainer reviews your entry before it appears in the catalog.

  • Coming from Prisma ORM 7: What each Prisma ORM 7 schema attribute, command, and query is called in Prisma ORM 8, and what is not available.
  • Core concepts: The ideas every Prisma ORM command and API builds on: contracts, emitting, plans, the database signature, codecs, and the migration graph.
  • Overview: Describe the data your application needs with models, primary keys, scalar fields, and relations.
  • Prisma 7: Prisma ORM is a next-generation Node.js and TypeScript ORM that provides type-safe database access, migrations, and a visual data editor.
  • Prisma ORM: Learn about Prisma ORM
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu