Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Prisma · Const

driverAdapters

driverAdapters is a Prisma Client preview feature for using JavaScript database drivers through driver adapters. Adapters translate Prisma queries for supported database or serverless drivers.

Since
5.4.0

How it works

The driverAdapters preview feature lets Prisma Client use a JavaScript database driver through an adapter. The adapter translates between Prisma Client and that driver; Prisma still turns client queries into SQL, while the adapter-backed driver sends those queries to the database.

Syntax

previewFeatures = ["driverAdapters"]

Parameters

NameTypeDescription
adapterDriverAdapterAn adapter instance implementing the database-driver integration used by Prisma Client.

Key points

  • The feature lets Prisma Client run database queries through JavaScript-native drivers.
  • An adapter is the translation layer between Prisma Client's API and the selected JavaScript driver.
  • Prisma converts Client queries into SQL before the adapter-backed driver executes them.
  • The docs group adapters into database driver adapters and serverless driver adapters.
  • Custom adapters are possible when the required database driver is not covered by a maintained adapter.
  • Prisma provides maintained adapters for several database drivers, including PostgreSQL, MySQL/MariaDB, and SQLite.

Common mistakes

  • With an adapter, configure the database connection when creating the adapter in application code rather than relying only on the Prisma schema.
  • For Prisma 6.6.0 and later, construct the adapter directly with the options expected by the native JavaScript driver.

Example: Use a PostgreSQL driver adapter

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["driverAdapters"]
}

// npm install @prisma/adapter-pg
import { PrismaClient } from "./generated/prisma";
import { PrismaPg } from "@prisma/adapter-pg";

const adapter = new PrismaPg({
  connectionString: process.env.DATABASE_URL!,
});
const prisma = new PrismaClient({ adapter });

const users = await prisma.user.findMany();
console.log(users);

Enable the preview feature, create a PostgreSQL adapter with the connection string, and pass it to PrismaClient.

When to use it

Native PostgreSQL integration

Use PostgreSQL through the native pg JavaScript driver while retaining Prisma Client's query API.

Serverless database access

Connect Prisma to a database through a driver designed for serverless or edge deployment.

Custom adapter development

Integrate a database driver for which Prisma does not provide a maintained adapter.

Interview questions

QWhat does the driverAdapters preview feature provide?

driverAdapters enables Prisma Client to work with JavaScript database drivers through adapter objects. The adapter translates between Prisma Client and the selected driver, which executes the generated SQL against the database.

Follow-up: Why might an application choose an adapter? It can use a supported native JavaScript driver, including drivers suited to serverless environments, instead of relying exclusively on Prisma's built-in connection path.

QHow do you connect Prisma Client through a PostgreSQL adapter?

Create the database-specific adapter, configure it with the connection details, and pass it to new PrismaClient({ adapter }). The PostgreSQL example uses PrismaPg from @prisma/adapter-pg.

Follow-up: Where should the connection string be configured? In application code when the adapter is initialized, because adapter-based connections require it there.

QWhat kinds of driver adapters are documented?

The documentation distinguishes database driver adapters from serverless driver adapters. Prisma maintains adapters for several drivers, and developers can also build an adapter for another database driver.

Follow-up: What is the role of a community adapter? It extends the same integration approach to drivers or platforms not maintained directly by Prisma.

  • queryCompiler
  • PrismaClient
  • PrismaPg
  • @prisma/adapter-pg
  • serverless driver adapters
  • database driver adapters

Source: Prisma ORM v6 - Database drivers. Checked 2026-10-16.