9 parts · 12 chapters
ORM Internals
You use an ORM daily, and it is a black box that writes your SQL. Opening it (identity maps, units of work, lazy loading, hydration) is how you stop being surprised in production by N+1 queries, unexpected locks and slow pages.
Nine parts following the syllabus: the impedance mismatch; core machinery; query building; Prisma; Drizzle; TypeORM, Sequelize, Kysely and MikroORM; the reference implementations (Hibernate, ActiveRecord, SQLAlchemy, Django ORM); ORMs at staff level; and a capstone that builds an ORM.
the mismatchObjects versus relations, Data Mapper versus Active Record.
machineryIdentity maps, units of work, dirty checking, lazy loading, N+1.
queriesFluent APIs to ASTs to SQL, parameter binding, hydration.
the JS ecosystemPrisma, Drizzle, TypeORM, Sequelize, Kysely, MikroORM.
the referencesHibernate, ActiveRecord, SQLAlchemy, Django ORM.
at scaleProfiling, migrations, pooling, tenancy, testing, and the RFC position.
00
The Impedance Mismatch
Objects and tables disagree · Data Mapper versus Active Record
2 ch · ~12 min01The Core Machinery
Sessions, identity and units of work · Lazy loading and N+1
2 ch · ~12 min02Query Building
The pipeline · Type mapping
2 ch · ~12 min03Prisma
Schema, client and engine
1 ch · ~8 min04Drizzle
SQL-first in TypeScript
1 ch · ~8 min05TypeORM, Sequelize, Kysely and MikroORM
Four more, compared
1 ch · ~8 min06The Reference Implementations
Four mature designs
1 ch · ~8 min07ORMs at Staff Level
The position, written down
1 ch · ~8 min08Capstone: Build Your Own ORM
The build
1 ch · ~8 minBuilt on SQL and the engine coursesAssumes SQL, The Language and the MySQL or PostgreSQL course. The language courses show Django ORM, Active Record and Hibernate in context.