Prompt Buddy logoPrompt Buddy

prisma ยท Prisma Docs

Prisma Auth.js (with Next.js) (/docs/guides/authentication/authjs/nextjs)

A step-by-step guide to integrating Auth.js into a Next.js application using the App Router and persisting user data in a Prisma Postgres database.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Prisma Auth.js (with Next.js) (/docs/guides/authentication/authjs/nextjs)

A step-by-step guide to integrating Auth.js into a Next.js application using the App Router and persisting user data in a Prisma Postgres database.

When To Use

Use when you need to implement a full authentication flow in a Next.js application that stores user information in a Prisma-managed database.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-workflow-guide.mdA guide explaining how to implement Auth.js authentication within a Next.js application using Prisma.Questions about a guide explaining how to implement Auth.js authentication within a Next.js application using Prisma.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma.bashA bash command to initialize a new Next.js application named authjs-prisma for use with Auth.js and Prisma.Exact payloads, commands, or snippets shown in A bash command to initialize a new Next.js application named authjs-prisma for use with Auth.js and Prisma.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-2.bashA bash command to initialize a new Next.js application named authjs-prisma using pnpm.Exact payloads, commands, or snippets shown in A bash command to initialize a new Next.js application named authjs-prisma using pnpm.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-3.bashA bash command to initialize a new Next.js application named authjs-prisma for use with Auth.js and Prisma.Exact payloads, commands, or snippets shown in A bash command to initialize a new Next.js application named authjs-prisma for use with Auth.js and Prisma.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-4.bashA bash command to initialize a new Next.js application using bunx for an Auth.js and Prisma integration.Exact payloads, commands, or snippets shown in A bash command to initialize a new Next.js application using bunx for an Auth.js and Prisma integration.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-5.bashBash commands to navigate to the authjs-prisma directory for the Prisma Auth.js and Next.js guide.Exact payloads, commands, or snippets shown in Bash commands to navigate to the authjs-prisma directory for the Prisma Auth.js and Next.js guide.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-6.bashThe bash command to install prisma, tsx, and postgres types as development dependencies for an Auth.js and Next.js setup.Exact payloads, commands, or snippets shown in The bash command to install prisma, tsx, and postgres types as development dependencies for an Auth.js and Next.js se...
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-7.bashA bash command to install prisma, tsx, and postgres type definitions using pnpm for an Auth.js and Next.js setup.Exact payloads, commands, or snippets shown in A bash command to install prisma, tsx, and postgres type definitions using pnpm for an Auth.js and Next.js setup.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-8.bashBash commands to install prisma, tsx, and postgres types as development dependencies for an Auth.js and Next.js setup.Exact payloads, commands, or snippets shown in Bash commands to install prisma, tsx, and postgres types as development dependencies for an Auth.js and Next.js setup.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-9.bashA bash command to install prisma, tsx, and postgres types using the bun package manager for an Auth.js and Next.js setup.Exact payloads, commands, or snippets shown in A bash command to install prisma, tsx, and postgres types using the bun package manager for an Auth.js and Next.js se...
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-10.bashThe bash command to install the Prisma client, PostgreSQL adapter, dotenv, and pg packages for an Auth.js integration with Next.js.Exact payloads, commands, or snippets shown in The bash command to install the Prisma client, PostgreSQL adapter, dotenv, and pg packages for an Auth.js integration...
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-11.bashA bash command to install the Prisma client, PostgreSQL adapter, dotenv, and pg packages using pnpm for an Auth.js integration with Next.js.Exact payloads, commands, or snippets shown in A bash command to install the Prisma client, PostgreSQL adapter, dotenv, and pg packages using pnpm for an Auth.js in...
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-12.bashBash command to install Prisma client, PostgreSQL adapter, and dotenv dependencies for an Auth.js Next.js integration.Exact payloads, commands, or snippets shown in Bash command to install Prisma client, PostgreSQL adapter, and dotenv dependencies for an Auth.js Next.js integration.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-13.bashA bash command to install the Prisma client, PostgreSQL adapter, dotenv, and pg using the bun package manager for an Auth.js Next.js integration.Exact payloads, commands, or snippets shown in A bash command to install the Prisma client, PostgreSQL adapter, dotenv, and pg using the bun package manager for an...
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-14.bashA bash command to initialize Prisma with a specific output directory for use in a Next.js application with Auth.js.Exact payloads, commands, or snippets shown in A bash command to initialize Prisma with a specific output directory for use in a Next.js application with Auth.js.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-15.bashA bash command to initialize Prisma with a specific output directory for use in a Next.js and Auth.js project.Exact payloads, commands, or snippets shown in A bash command to initialize Prisma with a specific output directory for use in a Next.js and Auth.js project.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-16.bashA bash command to initialize Prisma with a specific output directory for use in a Next.js application with Auth.js.Exact payloads, commands, or snippets shown in A bash command to initialize Prisma with a specific output directory for use in a Next.js application with Auth.js.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-17.bashA bash command to initialize Prisma with a specific output directory using bunx.Exact payloads, commands, or snippets shown in A bash command to initialize Prisma with a specific output directory using bunx.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-18.bashA bash command to initialize the database using npx create-db within a Prisma and Auth.js Next.js project.Exact payloads, commands, or snippets shown in A bash command to initialize the database using npx create-db within a Prisma and Auth.js Next.js project.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-19.bashA bash command using pnpm to execute the create-db utility for a Prisma Auth.js and Next.js setup.Exact payloads, commands, or snippets shown in A bash command using pnpm to execute the create-db utility for a Prisma Auth.js and Next.js setup.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-20.bashA bash command to initialize the database using yarn dlx create-db for a Prisma and Auth.js Next.js integration.Exact payloads, commands, or snippets shown in A bash command to initialize the database using yarn dlx create-db for a Prisma and Auth.js Next.js integration.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-21.bashA bash command using bunx to execute the create-db utility for a Prisma and Auth.js Next.js setup.Exact payloads, commands, or snippets shown in A bash command using bunx to execute the create-db utility for a Prisma and Auth.js Next.js setup.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma.prismaA Prisma schema file configured with a PostgreSQL datasource and a custom client output path for use with Auth.js in a Next.js environment.Exact payloads, commands, or snippets shown in A Prisma schema file configured with a PostgreSQL datasource and a custom client output path for use with Auth.js in...
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-2.prismaA Prisma schema definition for the Account model used in an Auth.js integration with Next.js.Exact payloads, commands, or snippets shown in A Prisma schema definition for the Account model used in an Auth.js integration with Next.js.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma.tsA TypeScript configuration file demonstrating the integration of Prisma with Auth.js in a Next.js environment.Exact payloads, commands, or snippets shown in A TypeScript configuration file demonstrating the integration of Prisma with Auth.js in a Next.js environment.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-22.bashA bash command to initialize the database schema using Prisma migrate dev.Exact payloads, commands, or snippets shown in A bash command to initialize the database schema using Prisma migrate dev.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-23.bashA bash command to initialize the database schema using pnpm and Prisma migrate dev.Exact payloads, commands, or snippets shown in A bash command to initialize the database schema using pnpm and Prisma migrate dev.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-24.bashA bash command to initialize the database schema using Prisma Migrate for an Auth.js and Next.js integration.Exact payloads, commands, or snippets shown in A bash command to initialize the database schema using Prisma Migrate for an Auth.js and Next.js integration.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-25.bashA bash command to initialize the database schema using bunx and prisma migrate dev.Exact payloads, commands, or snippets shown in A bash command to initialize the database schema using bunx and prisma migrate dev.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-26.bashA bash command to generate the Prisma client for use with Auth.js in a Next.js application.Exact payloads, commands, or snippets shown in A bash command to generate the Prisma client for use with Auth.js in a Next.js application.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-27.bashA bash command to generate the Prisma client using pnpm dlx.Exact payloads, commands, or snippets shown in A bash command to generate the Prisma client using pnpm dlx.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-28.bashA bash command to generate the Prisma client using yarn dlx.Exact payloads, commands, or snippets shown in A bash command to generate the Prisma client using yarn dlx.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-29.bashA bash command to generate the Prisma client using bunx and the bun runtime.Exact payloads, commands, or snippets shown in A bash command to generate the Prisma client using bunx and the bun runtime.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma.typescriptA TypeScript implementation demonstrating how to configure the Prisma adapter for Auth.js within a Next.js application.Exact payloads, commands, or snippets shown in A TypeScript implementation demonstrating how to configure the Prisma adapter for Auth.js within a Next.js application.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-30.bashThe bash command to install the Prisma adapter and NextAuth beta package for Auth.js integration.Exact payloads, commands, or snippets shown in The bash command to install the Prisma adapter and NextAuth beta package for Auth.js integration.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-31.bashA bash command to install the Prisma adapter and NextAuth beta using pnpm.Exact payloads, commands, or snippets shown in A bash command to install the Prisma adapter and NextAuth beta using pnpm.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-32.bashThe bash command to install the Prisma adapter and NextAuth beta package using yarn.Exact payloads, commands, or snippets shown in The bash command to install the Prisma adapter and NextAuth beta package using yarn.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-33.bashA bash command to install the Prisma adapter and NextAuth beta using the bun package manager.Exact payloads, commands, or snippets shown in A bash command to install the Prisma adapter and NextAuth beta using the bun package manager.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-34.bashA bash command to generate and copy a secret for Auth.js using the npx auth utility.Exact payloads, commands, or snippets shown in A bash command to generate and copy a secret for Auth.js using the npx auth utility.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-35.bashA bash command to generate and copy an authentication secret using the auth package via pnpm.Exact payloads, commands, or snippets shown in A bash command to generate and copy an authentication secret using the auth package via pnpm.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-36.bashA bash command to generate and copy an authentication secret using the auth package via yarn dlx.Exact payloads, commands, or snippets shown in A bash command to generate and copy an authentication secret using the auth package via yarn dlx.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-37.bashA bash command to generate and copy an authentication secret using bunx and the auth CLI.Exact payloads, commands, or snippets shown in A bash command to generate and copy an authentication secret using bunx and the auth CLI.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-38.bashA bash script defining the required environment variables for configuring Prisma with Auth.js in a Next.js application.Exact payloads, commands, or snippets shown in A bash script defining the required environment variables for configuring Prisma with Auth.js in a Next.js application.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-39.bashA bash script defining the required environment variables for configuring Auth.js with Prisma and Next.js.Exact payloads, commands, or snippets shown in A bash script defining the required environment variables for configuring Auth.js with Prisma and Next.js.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-2.typescriptA TypeScript implementation of NextAuth configuration using Prisma as the adapter within a Next.js application.Exact payloads, commands, or snippets shown in A TypeScript implementation of NextAuth configuration using Prisma as the adapter within a Next.js application.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-3.typescriptA TypeScript implementation of NextAuth configuration using Prisma adapters within a Next.js application.Exact payloads, commands, or snippets shown in A TypeScript implementation of NextAuth configuration using Prisma adapters within a Next.js application.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-4.typescriptA TypeScript code example demonstrating how to configure NextAuth with the PrismaAdapter for a Next.js application.Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to configure NextAuth with the PrismaAdapter for a Next.js application.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma.tsxA TypeScript React component demonstrating how to export the auth middleware for Next.js integration.Exact payloads, commands, or snippets shown in A TypeScript React component demonstrating how to export the auth middleware for Next.js integration.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-40.bashBash commands to create the directory structure and route files for NextAuth.js integration within a Next.js application.Exact payloads, commands, or snippets shown in Bash commands to create the directory structure and route files for NextAuth.js integration within a Next.js applicat...
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-2.tsxA TypeScript React file defining the GET and POST route handlers for Auth.js integration within a Next.js application using Prisma.Exact payloads, commands, or snippets shown in A TypeScript React file defining the GET and POST route handlers for Auth.js integration within a Next.js application...
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-3.tsxA TypeScript React component demonstrating the integration of Auth.js sign-in and sign-out functions within a Next.js application using Prisma.Exact payloads, commands, or snippets shown in A TypeScript React component demonstrating the integration of Auth.js sign-in and sign-out functions within a Next.js...
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-4.tsxA TypeScript React component implementation demonstrating SignIn and SignOut functionality using Auth.js within a Next.js application.Exact payloads, commands, or snippets shown in A TypeScript React component implementation demonstrating SignIn and SignOut functionality using Auth.js within a Nex...
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-5.tsxA TypeScript React component implementation demonstrating server actions for signIn and signOut using Auth.js in a Next.js environment.Exact payloads, commands, or snippets shown in A TypeScript React component implementation demonstrating server actions for signIn and signOut using Auth.js in a Ne...
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-6.tsxA TypeScript React component demonstrating the integration of Auth.js with Prisma within a Next.js page.Exact payloads, commands, or snippets shown in A TypeScript React component demonstrating the integration of Auth.js with Prisma within a Next.js page.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-7.tsxA TypeScript React component demonstrating the integration of Auth.js with Prisma in a Next.js application using SignIn and SignOut components.Exact payloads, commands, or snippets shown in A TypeScript React component demonstrating the integration of Auth.js with Prisma in a Next.js application using Sign...
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-8.tsxA Next.js page component demonstrating how to retrieve and display a user session using Auth.js and Prisma.Exact payloads, commands, or snippets shown in A Next.js page component demonstrating how to retrieve and display a user session using Auth.js and Prisma.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-9.tsxA Next.js page component using Auth.js to retrieve a user session and fetch corresponding user data from Prisma.Exact payloads, commands, or snippets shown in A Next.js page component using Auth.js to retrieve a user session and fetch corresponding user data from Prisma.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma.jsonA JSON configuration file demonstrating the setup for Prisma with Auth.js in a Next.js environment.Exact payloads, commands, or snippets shown in A JSON configuration file demonstrating the setup for Prisma with Auth.js in a Next.js environment.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-41.bashThe bash command used to start the development server for a Next.js application integrated with Prisma and Auth.js.Exact payloads, commands, or snippets shown in The bash command used to start the development server for a Next.js application integrated with Prisma and Auth.js.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-42.bashThe bash command used to start the development server for a Prisma and Auth.js Next.js application.Exact payloads, commands, or snippets shown in The bash command used to start the development server for a Prisma and Auth.js Next.js application.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-43.bashThe bash command used to start the Next.js development server for the Prisma Auth.js guide.Exact payloads, commands, or snippets shown in The bash command used to start the Next.js development server for the Prisma Auth.js guide.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-44.bashA bash command to run the Next.js development server using the Bun runtime for a Prisma and Auth.js integration.Exact payloads, commands, or snippets shown in A bash command to run the Next.js development server using the Bun runtime for a Prisma and Auth.js integration.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-45.bashA bash command to launch Prisma Studio for inspecting the database used in a Prisma and Auth.js Next.js integration.Exact payloads, commands, or snippets shown in A bash command to launch Prisma Studio for inspecting the database used in a Prisma and Auth.js Next.js integration.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-46.bashA bash command to launch Prisma Studio for managing database data during Auth.js integration.Exact payloads, commands, or snippets shown in A bash command to launch Prisma Studio for managing database data during Auth.js integration.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-47.bashA bash command to launch Prisma Studio for managing the database used in the Auth.js and Next.js integration.Exact payloads, commands, or snippets shown in A bash command to launch Prisma Studio for managing the database used in the Auth.js and Next.js integration.
examples/prisma-auth-js-with-next-docs-guides-authentication-authjs-nextjs-prisma-48.bashA bash command to run Prisma Studio using the bunx runner within a Next.js and Auth.js environment.Exact payloads, commands, or snippets shown in A bash command to run Prisma Studio using the bunx runner within a Next.js and Auth.js environment.

What This Skill Covers

  • Auth.js (with Next.js) (/docs/guides/authentication/authjs/nextjs)
  • Main sections: npm, pnpm, yarn, bun, npm.

Workflow

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. Do not add behavior or configuration that is not present in the attached source files.

Canonical source: https://www.prisma.io/docs/guides/authentication/authjs/nextjs