API Reference

Prisma

Next-generation TypeScript ORM with auto-generated types, migrations, and a declarative data modeling language.

Official Documentation ↗
CompatibilityThis documentation covers version v5.15. Check the official docs for the latest API surface.

Installation

npmnpm install prisma && npx prisma init
pnpmpnpm add prisma && pnpm exec prisma init

Methods

Prisma is a next-generation ORM for Node.js and TypeScript that provides a type-safe database client auto-generated from a declarative schema. It handles migrations, type inference, and query building automatically, eliminating raw SQL boilerplate.

Key Features

  • Type-safe client: Auto-generated from schema with full type inference
  • Declarative schema: Prisma Schema Language for models and relations
  • Migrations: Automatic migration generation and history management
  • Multi-database: PostgreSQL, MySQL, SQLite, MongoDB, SQL Server
  • Prisma Studio: GUI for browsing and editing data at /studio
  • Connection pooling: Built-in pool via Prisma Data Platform

FAQ

How does Prisma compare to Drizzle ORM?
Prisma generates a client from a declarative schema, providing full type safety and auto-completion. Drizzle uses SQL-like syntax with zero code generation. Prisma is easier for beginners; Drizzle offers more control and smaller bundle size.
What databases does Prisma support?
PostgreSQL, MySQL, SQLite, MongoDB, SQL Server, and CockroachDB. Each has full type safety, migrations, and native relation handling. Prisma also supports connection pooling via Prisma Data Platform.
How do I handle N+1 queries?
Use include or select to eagerly load relations. Prisma automatically optimizes joins. For complex queries, use prisma.$transaction or raw SQL via prisma.$queryRaw. The N+1 problem is visible in Prisma Studio.