Object-Relational Mapping (ORM) frameworks bridge the gap between object-oriented programming and relational databases by abstracting SQL operations into type-safe, language-native code. ORMs handle schema management, query generation, and data mapping automatically, enabling developers to work with database records as objects while the framework manages connection pooling, transactions, and query optimization. The key mental model: ORMs trade some performance and control for developer productivity and type safety, but understanding when to use eager loading vs lazy loading, how to prevent N+1 queries, and when to drop down to raw SQL separates effective ORM usage from performance disasters. In 2026, the landscape has matured dramatically — Prisma 7 dropped its Rust engine for pure TypeScript, Drizzle dominates edge/serverless, and standalone SQL query builders like Kysely offer type safety without ORM abstraction overhead.
What This Cheat Sheet Covers
This topic spans 16 focused tables and 119 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: Popular ORM Frameworks
The ORM ecosystem spans every major backend language, with different tools optimizing for developer experience, SQL transparency, performance, or edge-runtime compatibility. The right choice depends on your language ecosystem, team SQL fluency, and deployment target — not benchmark marketing.
| Framework | Example | Description |
|---|---|---|
const user = await prisma.user.findUnique( { where: { id: 1 } }) | • Schema-first ORM for TypeScript/Node.js with generated type-safe client, Prisma Studio, and Prisma Migrate • Prisma 7 removed the Rust query engine — now pure TypeScript: 90% smaller bundle, 3x faster queries, edge-compatible • supports PostgreSQL, MySQL, SQLite, MongoDB, SQL Server, CockroachDB. | |
const users = await db.select() .from(usersTable) .where(eq(usersTable.id, 1)); | • SQL-first TypeScript ORM with zero codegen step — schema defined in TypeScript, types inferred instantly on save • edge-native (Cloudflare Workers, Vercel Edge, Deno); two APIs: SQL-like Select API and higher-level Query API • minimal bundle (~12 KB gzipped), zero dependencies. | |
const user = await db .selectFrom('users') .select(['id', 'name']) .where('id', '=', 1) .executeTakeFirst(); | • Type-safe SQL query builder for TypeScript — not a full ORM; compile-time type checking on every table, column, join, and alias • zero dependencies, runs everywhere (Node, Deno, Bun, Cloudflare Workers); built-in migration primitives via kysely-ctl. | |
@Entity()class User { @PrimaryGeneratedColumn() id: number;} | • Decorator-based ORM for TypeScript/JavaScript supporting both Active Record and Data Mapper patterns • broad database support including Oracle; still widely used in NestJS enterprise codebases, but losing ground to Drizzle/Prisma for greenfield projects. | |
user.name = 'Alice';await em.flush(); | • Data Mapper + Unit of Work ORM for TypeScript — automatically batches entity changes into a single transaction on flush()• Identity Map ensures each entity loads once per request; strong TypeScript support with composite keys and polymorphism. | |
const User = sequelize.define('User', { name: DataTypes.STRING}); | • Mature promise-based ORM for Node.js with model definitions, hooks, transactions, and migrations • supports PostgreSQL, MySQL, MariaDB, SQLite, MSSQL; widely used but less type-safe than Drizzle or Prisma. |