Installation
This guide covers how to install Prisma ORM in your project using your preferred package manager.System requirements
Before installing Prisma, ensure your system meets these requirements:- Node.js: Version 20.19+, 22.12+, or 24.0+
- TypeScript: Version 5.4.0 or higher (optional, but recommended)
- Package manager: npm, yarn, pnpm, or bun
Prisma ORM works with both JavaScript and TypeScript, but TypeScript is recommended for the best developer experience with full type safety.
Installation methods
Prisma consists of two main packages:prisma- The Prisma CLI for database migrations, schema management, and client generation@prisma/client- The Prisma Client runtime for querying your database
Install with npm
npm is the default package manager that comes with Node.js.Install Prisma CLI
Install Prisma Client
Install both packages
Install with Yarn
Yarn is a popular alternative package manager with improved performance and security.Install Prisma CLI
Install Prisma Client
Install both packages
Install with pnpm
pnpm is a fast, disk-efficient package manager that’s gaining popularity, especially in monorepos.Install Prisma CLI
Install Prisma Client
Install both packages
Install with Bun
Bun is an all-in-one JavaScript runtime and toolkit with a built-in package manager.Install Prisma CLI
Install Prisma Client
Install both packages
Bun automatically loads
.env files, so you don’t need to import dotenv/config in your Prisma configuration when using Bun.Install database adapters
Prisma uses driver adapters to connect to databases. Install the appropriate adapter for your database:PostgreSQL
Neon (Serverless PostgreSQL)
PlanetScale (Serverless MySQL)
SQLite
LibSQL (Turso)
Cloudflare D1
MySQL/MariaDB
SQL Server
Verify installation
After installation, verify that Prisma is installed correctly:Next steps
Now that Prisma is installed, you’re ready to start using it:Follow the Quickstart
Step-by-step guide to build your first Prisma application
Read the Schema Reference
Learn about all the schema syntax and options
Prisma configuration file
Prisma 7 uses a TypeScript configuration file for database connections and settings. Create aprisma.config.ts file:
prisma.config.ts
env function provides type-safe access to environment variables and throws an error if required variables are missing at runtime.
Unlike Prisma 6 and earlier, Prisma 7 does not automatically load
.env files. Use packages like dotenv or @dotenvx/dotenvx to load environment variables, or use Node.js built-in --env-file flag.Loading environment variables
To load environment variables from a.env file:
Using dotenv
Install dotenv:prisma.config.ts
Using Node.js —env-file flag
Node.js 20.6+ supports loading environment variables directly:Using Bun
Bun automatically loads.env files, so no additional configuration is needed.
Updating Prisma
To update Prisma to the latest version:Troubleshooting
Version mismatch
If you encounter errors about version mismatches, ensure both packages are at the same version:TypeScript errors
If you see TypeScript errors after installation, ensure you have TypeScript 5.4.0 or higher:Missing native dependencies
Some database adapters require native dependencies. For example,better-sqlite3 requires build tools. On error, follow the package’s installation instructions for your platform.