ORMs vs. Query Builders for your Typescript application
Drizzle, Kysely, Prisma and Zapatos are compared as type-safe Postgres libraries for TypeScript across schema definition, query syntax, raw SQL support, migrations, edge-runtime support and community size. Drizzle offers SQL-like syntax with drizzle-kit migration generation, Kysely favors WYSIWYG TypeScript-centric queries with hand-written up/down migrations, Zapatos generates types from the database but has no migrations, and Prisma uses its own schema language with Prisma Migrate. Performance differences were negligible in a small test (averages within 3ms). Prisma has by far the largest community, while the other three can run on edge runtimes via serverless Postgres drivers, which Prisma could not at the time.
Related posts
- Build a Database App with Drizzle ORM and Deno
Deno mediumAdeptDrizzle ORM can be used from Deno via npm compatibility to get type-safe CRUD access to PostgreSQL. The walkthrough installs drizzle-orm, drizzle-kit and pg, configures drizzle.config.ts with a DATABASE_URL, and shows two schema paths: introspecting an existing database with `drizzle-kit pull` or defining pgTable schemas in TypeScript and generating migrations with `drizzle-kit generate`. It then builds helper functions for inserting, querying, updating and deleting rows across two related tables using a pg Pool-backed Drizzle client, with the Deno flags (--env, --node-modules-dir) needed to make drizzle-kit work.
- When to choose an ORM for your Database
Turso easyNoviceORMs, query builders and raw SQL each fit different situations, and many projects do best mixing them. ORMs offer generated types, migrations, database portability and framework conventions (Rails, Laravel, NestJS), while raw SQL avoids performance overhead, missing adapters, large serverless bundles and opaque generated queries. Query builders sit in between, giving more control than an ORM while still requiring SQL knowledge. Examples show Prisma's libSQL adapter, Drizzle with @libsql/client, and plain @libsql/client queries against Turso.
- Better Postgres with Prisma Experience
Neon mediumAdept
Prisma users on Neon can now use a single pooled Postgres connection string for both serverless queries and schema migrations, replacing separate pooled, direct and shadow database URLs. PgBouncer 1.22.0 added support for prepared statements and DISCARD ALL/DEALLOCATE ALL, which fixes the "prepared statement already exists" errors `prisma migrate` used to hit through the pooler, and the `pgbouncer=true` parameter is no longer needed. Neon also enabled role and database management via SQL, and Prisma 5.10.0 added DROP DATABASE WITH (FORCE), so `prisma migrate dev` can create and drop its own shadow database without manual setup.
- @neondatabase/serverless hits 1.0.0
Neon mediumAdept
Neon's JavaScript/TypeScript serverless driver, which carries Postgres queries over HTTP and WebSockets for environments without raw TCP such as V8 isolates and browsers, reaches 1.0.0 after a refactor that adds auto-generated types via api-extractor and CI tests across Node, Bun, Deno, browsers, Cloudflare Workers, Vercel and the Prisma/Drizzle adapters. Tagged-template queries are now composable, because placeholder numbering is deferred until execution. A breaking change makes calling sql(...) as a plain function an error, since that form used ordinary string interpolation and invited SQL injection. New sql.query and sql.unsafe helpers cover the parameterized and trusted-raw-SQL cases. Binary inserts over HTTP now hex-encode roughly 10x faster, though WebSockets remain the recommended path for large blobs.
- Build a serverless API using Cloudflare Workers, Drizzle ORM, and Neon
Neon mediumAdept
A step-by-step setup for a serverless TypeScript API on Cloudflare Workers that uses Hono for routing, Drizzle ORM for schema definition and migrations, and Neon serverless Postgres for storage. It scaffolds a Worker with create-cloudflare, defines a products table in TypeScript, and uses drizzle-kit to generate SQL migrations. Migrations run through a postgres.js script capped at a single connection so they execute in order. The Worker queries Neon over HTTP via @neondatabase/serverless, is deployed with wrangler, and gets its DATABASE_URL from Cloudflare's Neon integration instead of manually configured secrets.