Features
- Declarative schema with Prisma Schema Language
- Auto-generated, type-safe query client
- Prisma Migrate for database migrations
- Prisma Studio for visual data browsing
Pros
- Best-in-class type safety and autocompletion
- Intuitive schema-first workflow
- Excellent documentation and community
Cons
- Generated client adds bundle size
- Complex queries sometimes require raw SQL
- Schema language is proprietary, not standard SQL
Overview
Prisma is a next-generation TypeScript ORM that takes a schema-first approach to database access. You define your data model in the Prisma Schema Language, and Prisma generates a fully type-safe client tailored to your schema, providing autocompletion and compile-time error checking for every database query.
Prisma supports PostgreSQL, MySQL, SQLite, MongoDB, CockroachDB, and SQL Server. Its migration tool (Prisma Migrate) generates SQL migrations from schema changes, and Prisma Studio provides a visual interface for browsing and editing data.
When to Use
Prisma is excellent for TypeScript projects that value developer experience and type safety. It’s ideal for teams that prefer a schema-first workflow and want generated, fully-typed database clients. For projects that need more SQL control, Drizzle or Kysely may be better fits.
Getting Started
npm install prisma @prisma/client
npx prisma init
// prisma/schema.prisma
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
}
import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();
const users = await prisma.user.findMany();