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

Auth.js · Function

PrismaAdapter

PrismaAdapter connects Auth.js to a Prisma-backed database. Give it an initialized Prisma client and place the returned Adapter in Auth.js configuration.

How it works

PrismaAdapter receives a Prisma client and converts it into an Auth.js database adapter. Pass the returned adapter to Auth.js configuration so authentication data can be stored and retrieved through Prisma.

Syntax

function PrismaAdapter(prisma): Adapter

Parameters

NameTypeDescription
prismaPrismaClient | DynamicClientExtensionThisInitialized Prisma client used by the adapter to access the database.

Returns

Adapter

Key points

  • It is the officially supported Prisma integration for Auth.js and NextAuth.js.
  • The function takes one Prisma client argument and produces an Auth.js Adapter.
  • Install the Prisma client package and the Auth.js Prisma adapter package before using the function.
  • Configure the returned adapter by assigning the PrismaAdapter call to Auth.js's adapter option.

Example: Configure Auth.js with Prisma

import NextAuth from "next-auth"
import { PrismaAdapter } from "@auth/prisma-adapter"
import { prisma } from "@/prisma"

export const { handlers, auth, signIn, signOut } = NextAuth({
  adapter: PrismaAdapter(prisma),
  providers: [],
})

Creates an Auth.js configuration that persists authentication data through the Prisma client.

When to use it

Database-backed authentication

Persist users, accounts, sessions, and verification data through Prisma in an Auth.js application.

Prisma client integration

Reuse a Prisma client configured for the application's database as Auth.js's persistence layer.

Framework authentication setup

Add the adapter to framework integrations such as NextAuth while keeping authentication configuration centralized.

Interview questions

QWhat does PrismaAdapter do?

PrismaAdapter is the official Prisma database adapter for Auth.js. It accepts a Prisma client and returns an Auth.js Adapter that can be supplied in the Auth.js configuration.

Follow-up: How would you use it in NextAuth? Instantiate PrismaClient, call PrismaAdapter(prisma), and assign the result to the adapter option.

QWhat are the input and output types?

The function parameter is a PrismaClient or compatible dynamic client extension. Its return type is Adapter, which is the interface Auth.js uses for database persistence.

Follow-up: Why is the returned type useful? It lets Auth.js consume the adapter through a standard interface independent of the underlying database implementation.

QHow is PrismaAdapter configured?

Install @auth/prisma-adapter together with @prisma/client, then import PrismaAdapter and pass it the initialized Prisma client. The resulting adapter is configured alongside providers.

Follow-up: What deployment concern can arise? Prisma-based configuration may be edge-incompatible, so the edge instance should omit the adapter.

  • Adapter
  • PrismaClient
  • @auth/prisma-adapter
  • @prisma/client
  • NextAuth

Source: Auth.js | Prisma Adapter. Checked 2026-10-15.