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

Neon · Const

Prisma integration

Connect Prisma ORM to Neon with @prisma/adapter-neon. Use a pooled URL for application queries and a direct URL for Prisma CLI operations such as migrations and schema pushes.

How it works

Prisma connects to Neon through @prisma/adapter-neon, which uses Neon's serverless driver and WebSockets. Configure a pooled connection for application queries and a direct connection for Prisma CLI operations such as migrations and schema pushes.

Syntax

new PrismaNeon({ connectionString: process.env.DATABASE_URL });
new PrismaClient({ adapter });

Returns

A configured PrismaClient instance that executes Prisma queries against Neon.

Key points

  • Configure the -pooler endpoint as the application's DATABASE_URL to support application traffic.
  • Configure the direct endpoint separately for Prisma CLI tasks, including migrations and introspection.
  • In Prisma ORM 7, place the CLI connection configuration in prisma.config.ts at the project root.
  • Run Prisma generate after configuring the schema so the generated client reflects the current data model.

Example: Prisma Client with Neon adapter

import 'dotenv/config';
import { PrismaNeon } from '@prisma/adapter-neon';
import { PrismaClient } from './generated/prisma/client';

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

const posts = await prisma.post.findMany();
console.log(posts);

This creates Prisma Client with Neon's adapter and uses the pooled application connection to query the database.

When to use it

Run application queries through the pooled Neon endpoint

Serverless Node.js or TypeScript application queries

Run Prisma migrations and db push with the direct endpoint

Database schema management

Use generated Prisma Client models against Neon

Type-safe data access

Interview questions

QHow do you connect Prisma ORM 7 to Neon?

Install @prisma/client, @prisma/adapter-neon, and the matching Prisma packages. Construct PrismaNeon with the application connection string, then pass that adapter to PrismaClient.

Follow-up: Why use two URLs? The pooled URL is designed for application traffic, while the direct URL is used by Prisma CLI operations.

QHow do pooled and direct connection strings differ?

The pooled URL contains -pooler in the hostname and is assigned to DATABASE_URL. DATABASE_URL_UNPOOLED contains the direct endpoint and is used by Prisma CLI commands such as migrations and db push.

Follow-up: What should be checked if CLI operations fail? Verify that the CLI is configured with DATABASE_URL_UNPOOLED rather than the pooled URL.

QWhat role does PrismaNeon play?

PrismaNeon is the driver adapter that connects Prisma Client through Neon's serverless driver. After configuring the adapter, normal Prisma queries can be executed through the generated client.

Follow-up: How can schema changes be applied? Generate the client, then use Prisma CLI commands such as prisma db push or migrations with the direct connection configured.

  • @prisma/adapter-neon
  • PrismaNeon
  • PrismaClient
  • DATABASE_URL
  • DATABASE_URL_UNPOOLED
  • prisma.config.ts
  • prisma/schema.prisma
  • npx prisma generate

Source: Connect from Prisma to Neon - Neon Docs. Checked 2026-10-16.