Prisma
The TypeScript-first ORM. Schema-driven, type-safe, the default for most modern Node apps.
Mindmap
The plain-English version
Prisma is a TypeScript ORM (Object-Relational Mapper) — it lets you describe your database schema in a single file, then gives you a fully type-safe client to query it. The schema becomes the source of truth: migrations, types, and the client are all generated from it.
The problem it solves
Pre-Prisma, Node ORMs were painful: TypeORM, Sequelize, Knex — all required juggling separate model files, migration files, and types. Prisma collapses them into one workflow. The generated TypeScript types catch query mistakes at compile time. The migration tooling is the calmest in the Node ecosystem.
Alternatives
| Alternative | Type | When it wins |
|---|---|---|
| Postgres | database | The serious open-source relational database. The default choice for most production apps that need structured data. |
| MongoDB | database | The dominant document database. Schemaless flexibility, JSON-shaped documents, harder consistency tradeoffs. |
| Redis | in-memory store | The in-memory key-value store. Fast cache, fast queue, fast everything that doesn't need durability. |
Deep links
The words you'll hear
schema.prisma- The schema file. Describes models, relations, datasource.
- Prisma Client
- Generated typed client.
prisma.task.findMany(...). - Migration
- Versioned SQL files in
prisma/migrations/.prisma migrate dev/deploy. - Prisma Studio
- Built-in GUI for browsing the database in development.
- Pulse, Accelerate
- Prisma's hosted services for real-time and connection pooling.
Bad vs. good prompt for Prisma
Why it works: Specifies the target stack, model shape requested, the migration command, and asks for the canonical Next.js singleton pattern that prevents the connection-leak warning new users always hit.
What bites real teams
Forgetting prisma generate in the build step → production runs old generated types. Most starters have it; verify.
Without the singleton pattern, hot-reloading creates new clients each save until you OOM.
findMany({ include: { tasks: true } }) avoids N+1; multiple separate queries don't. Read the relation docs once.