Prisma 2.0: TypeScript-first ORM with declarative schema

Prisma 2.0 (June 2020) by Prisma Labs: TypeScript/Node.js ORM with declarative schema DSL, migrations, type-safe query builder, Prisma Studio. PostgreSQL, MySQL, SQLite, SQL Server, MongoDB. Modern Node.js standard.

Open SourceWeb PrismaTypeScriptNode.jsORMDatabaseOpen SourceWeb

Node.js ORM: a gap

The Node ecosystem has historically had problematic ORMs:

  • Sequelize — Active Record pattern, TypeScript often “added later”
  • TypeORM — decorators, known bugs, slow maintenance
  • Mikro-ORM, Objection.js, Knex — niche

A schema-first, type-safe, modern-DX approach is needed.

The release

Prisma 2.0 is released by Prisma Labs (Berlin) on 9 June 2020. Apache 2.0 licence. Founders: Søren Bramer Schmidt, Johannes Schickling. Version 1.x was GraphQL-focused; 2.0 pivots to general-purpose ORM.

Architecture

  • Schema DSL (schema.prisma) — declarative definition of models, fields, relations
  • Prisma Client — TypeScript client generated from schema
  • Prisma Migrate — schema-diff based migrations
  • Prisma Studio — GUI for DB browsing
model User {
  id    Int    @id @default(autoincrement())
  email String @unique
  posts Post[]
}

model Post {
  id       Int    @id @default(autoincrement())
  title    String
  author   User   @relation(fields: [authorId], references: [id])
  authorId Int
}
const users = await prisma.user.findMany({
  where: { email: { endsWith: '@example.com' } },
  include: { posts: true }
});
// users is typed: User & { posts: Post[] }[]

Features

  • End-to-end type safety — types generated from schema, zero manual typing
  • Fluent query builder — no raw SQL (though supported with $queryRaw)
  • Declarative migrations
  • Full auto-complete in IDE
  • Nested writes — create related records in one call
  • Introspection — generate schema from existing DB (prisma db pull)
  • Seed data
  • Multi-DB: PostgreSQL, MySQL, SQLite, SQL Server, MongoDB, CockroachDB

Prisma Accelerate & Pulse

Prisma commercial products:

  • Accelerate — connection pooling and global cache (Edge-compatible)
  • Pulse — real-time change data capture
  • Prisma Data Platform — cloud console

Competitors

  • TypeORM, Sequelize — historical Node ORMs with Active Record / Data Mapper patterns
  • Mikro-ORM — Data Mapper alternative

In the Italian context

Prisma is entering Italian TypeScript-first Node.js teams: fintech/SaaS/AI startups, teams migrating from Sequelize/TypeORM and Next.js fullstack projects.


References: Prisma 2.0 (9 June 2020). Prisma Labs, Berlin. Søren Bramer Schmidt, Johannes Schickling. Apache 2.0 licence. Schema DSL, Client, Migrate, Studio. Multi-DB.

Need support? Under attack? Service Status
Need support? Under attack? Service Status