Skip to content

Comparison ​

This page helps you choose between kern-orm and other TypeScript ORMs and query builders for PostgreSQL: Drizzle ORM, Kysely, Prisma ORM, and Orchid ORM. It compares Drizzle ORM 0.45.4, Kysely 0.29.8, Prisma ORM 7.10.1, Orchid ORM 1.78.47, and kern-orm 0.17, as of November 2026, by their documentation and sources, which each row links.

When kern-orm fits ​

Choose kern-orm when your application on PostgreSQL needs:

  • Records with their related records, typed and loaded in one SQL statement.
  • Transactions that the functions it calls join without a transaction object passed to them.
  • A PostgreSQL schema per tenant, served by one db with the same table definitions and queries.
  • Tests that each run in a transaction that rolls back, including the transactions of the tested code.

Consider another library when you need what kern-orm does not have:

  • Databases other than PostgreSQL.
  • Migrations generated from your table definitions: with kern-migrations, you write each migration with helpers, SQL, or TypeScript.
  • Joins, and relations through other relations or through a join table.
  • A stable API: kern-orm is in early development, and its API changes between minor versions.

At a glance ​

kern-ormDrizzle ORMKyselyPrisma ORMOrchid ORM
Related records in one statementBuilt inBuilt inRequires a subquery per relationBehind a preview featureBuilt in
Transactions without passing them aroundBuilt in, from kern-dbNot supportedNot supportedNot supportedBuilt in
One db for a schema per tenantBuilt inNot supportedAn instance per schemaA client per schemaBuilt in
Tests in transactions that roll backBuilt in, from kern-dbRequires passing a transaction to the tested codeRequires passing a transaction to the tested code, which cannot nest oneThrough jest-prismaBuilt in
Rows of SQL textDecoded by declared types, from kern-dbTyped by an unchecked type argumentTyped by an unchecked type argumentTyped by an unchecked type argument, or generated in previewTyped by an unchecked type argument
MigrationsWritten, with kern-migrationsGeneratedWrittenGeneratedWritten or generated
Checking table definitions against the databaseA check of compatibilityNot supportedA check of generated types, through kysely-codegenA schema diffNot found

kern-orm takes transactions, test transactions, and queries of SQL text from kern-db, which it installs, and migrations from kern-migrations, which you install beside it; see Kern Libraries.

With kern-orm, select the related records of each row in the callback of select, at any depth: the query loads them in one SQL statement, with the shape of the result inferred; see Related Records.

  • Drizzle ORM: its relational queries, db.query, load relations in one statement of LEFT JOIN LATERAL subqueries (source).
  • Kysely: it has no relations; nest a correlated subquery of each relation in jsonArrayFrom or jsonObjectFrom (docs).
  • Prisma ORM: include loads relations in one statement only with the preview feature relationJoins, and in a query per table otherwise (docs).
  • Orchid ORM: relations selected in select load in one statement of LEFT JOIN LATERAL subqueries (docs).

Transactions without passing them around ​

With kern-orm, the queries in the callback of db.$transaction, including those of the functions it calls, run in the transaction; see Transactions.

  • Drizzle ORM: only the queries of the tx that transaction passes to its callback run in the transaction (source).
  • Kysely: only the queries of the transaction object run in the transaction (source).
  • Prisma ORM: only the queries of the tx that $transaction passes to its callback run in the transaction (docs).
  • Orchid ORM: the queries of db in the callback of $transaction run in the transaction (docs).

A schema per tenant ​

With kern-orm, pass bindSchema a function that returns the PostgreSQL schema of the current request, and one db serves every tenant; tables of a shared schema stay in it; see PostgreSQL schemas and Multiple Schemas.

  • Drizzle ORM: a table belongs to the schema of its definition, with no override at runtime (source).
  • Kysely: withSchema gives an instance that queries the tables in a schema, and the shared tables are qualified in the types of the database (docs).
  • Prisma ORM: a model with @@schema belongs to that schema (docs), and a model without it to the default schema of the client, which the schema option of PrismaPg sets, so a schema per tenant requires a client per schema (source).
  • Orchid ORM: the schema option of orchidORM takes a function, called for every query (docs).

Tests in transactions that roll back ​

With kern-orm, run each test in a transaction that rolls back, with node:test, bun:test, or Vitest; the tested code queries the db of your application, and its transactions run as nested transactions; see Testing.

  • Drizzle ORM: it has no test helper; the tested code joins a transaction of a test only through a tx passed to it, and its transactions in it are savepoints (source).
  • Kysely: it has no test helper; the tested code joins a transaction of a test only through a transaction object passed to it, and cannot start a transaction in it (source).
  • Prisma ORM: its guide of integration tests deletes the data after the tests (docs); jest-prisma, a library of its own, runs each Jest test in a transaction that rolls back.
  • Orchid ORM: testTransaction runs each test in a transaction that rolls back, and the transactions of the tested code in it as savepoints (docs).

Rows of SQL text ​

With kern-orm, pass the types of the fields to a query of SQL text: it decodes each field from its column, and rejects a result without the column; see SQL Statements.

  • Drizzle ORM, Kysely, and Orchid ORM: execute, sql, and $query type the rows by a type argument that nothing checks (Drizzle ORM, Kysely, Orchid ORM).
  • Prisma ORM: $queryRaw types the rows by a type argument that nothing checks (docs), and its preview feature TypedSQL generates the types of the rows of a SQL file from the database (docs).

Migrations ​

With kern-migrations, write each migration with schema helpers, SQL, or TypeScript functions, apply it, and test it; see Migrations.

  • Drizzle ORM: drizzle-kit generate generates migrations from your table definitions (source).
  • Kysely: its Migrator applies migrations that you write (docs).
  • Prisma ORM: prisma migrate dev generates SQL migrations from your models (docs).
  • Orchid ORM: you write migrations, or generate them from your tables with db g (docs).

Checking table definitions against the database ​

With kern-orm, check in a test that the database has what your table definitions rely on, such as their columns, keys, and foreign keys, while it may have more, such as other nullable columns; see Tables that match the database.

  • Drizzle ORM: drizzle-kit check checks the files of its migrations, not the database (source).
  • Kysely: kysely-codegen, a library of its own, generates TypeScript types from the database, and its --verify fails when the generated file is out of date.
  • Prisma ORM: prisma migrate diff with --exit-code fails when the structure of the database differs from your models in anything that Prisma ORM supports, such as an extra column (docs).
  • Orchid ORM: this comparison has not found such a check.