Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsApr 11, 2026·2 min de lecture

Prisma — Next-Generation ORM for Node.js & TypeScript

Prisma is a next-generation ORM for Node.js and TypeScript supporting PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB, and CockroachDB. Type-safe database access with auto-generated client and intuitive schema language.

Introduction

Prisma is a next-generation ORM for Node.js & TypeScript. Fully type-safe database access with auto-generated client from the Prisma schema. Supports PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB, and CockroachDB.

What Prisma Does

  • Prisma Schema — single source of truth for data model
  • Prisma Client — auto-generated, type-safe query builder
  • Prisma Migrate — declarative migrations from schema changes
  • Prisma Studio — GUI browser for database
  • Relation queriesinclude and select for nested data
  • Transactions — interactive and batch

Architecture

Schema → Prisma Engine (Rust) → Database. The TypeScript client wraps a Rust binary (or WASM in edge runtimes) that handles query compilation, connection pooling, and protocol. Types are generated from the schema on prisma generate.

Self-Hosting

Prisma is a library, not a service. Ships with your app. For connection pooling in serverless, use Prisma Accelerate (hosted) or PgBouncer/Supavisor self-hosted.

# Production
npx prisma migrate deploy
node dist/server.js

Key Features

  • Fully type-safe queries
  • Declarative schema (.prisma file)
  • Auto-migrations
  • Multi-database support
  • Prisma Studio (GUI)
  • Edge runtime support (Cloudflare, Vercel)
  • Interactive transactions
  • Full-text search (PostgreSQL)

Comparison

ORM Type Safety Migrations Performance Query Style
Prisma Excellent Auto Good Builder
Drizzle Excellent Manual Fastest SQL-like
TypeORM Decent Auto OK ActiveRecord/DataMapper
Sequelize Weak Auto OK Legacy
Kysely Excellent Manual Fast SQL builder

FAQ

Q: Prisma vs Drizzle? A: Prisma provides a higher-level abstraction (Schema DSL, automatic migrations) with great DX; Drizzle is closer to SQL, has a smaller bundle, and runs faster on edge runtimes.

Q: Slow cold start? A: Prisma 5+ provides driverAdapters, which remove the Rust engine and greatly improve cold starts.

Q: Can I write raw SQL? A: Yes. prisma.$queryRaw and $executeRaw support parameterized queries via template strings.

Sources & Credits

Discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires