Turbine

Why Turbine

Turbine is the TypeScript ORM for Postgres that runs 1.5x faster than Drizzle and 2.1x faster than Prisma, installs one dependency, and writes correct queries in an AI agent's hands on the first try. Here is what that gets you.

Faster than Drizzle and Prisma#

Turbine turns each query into one parameterized SQL statement, nested relations included, and caches it by shape. There is no query engine between your code and Postgres.

On the same data and the same connection pool, measured against hand-written pg queries:

TurbineDrizzlePrisma
Time against hand-written SQL1.09x1.59x2.13x

A user with their posts and each post's comments comes back in one round trip, with no N+1 and no waterfall. Every number is reproducible from the repo, and the benchmarks page publishes the scenarios Turbine loses too.

One dependency, almost nothing to attack#

Turbine's dependencies field has one entry: pg, the Postgres driver you would install anyway.

  • No engine binary, no WASM, no install scripts. Nothing runs when you npm install.
  • A security review fits in one line of package.json.
  • Published from CI with npm provenance. Every release is the exact tarball that passed the test suite, signed back to the commit that built it.

Fewer packages means fewer maintainers you are trusting and fewer places for a supply-chain attack to land.

Built for AI agents#

Coding agents get Turbine right. With the bundled skill installed, agents wrote correct Turbine queries on the first try 97% of the time, up from 73% without it.

npx turbine skill   # teaches your agent the query API
npx turbine mcp     # a read-only MCP server for your database
  • Mistakes fail at compile time. Query arguments are fully typed, so a wrong field or relation name is a type error, not a bad query at runtime.
  • Errors an agent can act on. Every error has a stable code, TURBINE_E001 to TURBINE_E020, with a link to the fix.
  • A database agents can explore safely. The MCP server has no write tools, runs every read inside a read-only transaction, and never sends PII-tagged columns to the model.

Setup for Claude Code, Cursor and others: Turbine for AI agents.

Find slow queries before your users do#

Most slow ORM queries come down to a missing index. Turbine finds them for you.

npx turbine doctor        # every unindexed foreign key, ranked by cost
npx turbine doctor --fix  # writes the migration that adds them

One missing index took a nested query from 17.8 seconds to 62 ms. As of July 2026, no other TypeScript ORM's CLI gives missing-index advice.

To see how Postgres runs a query, ask it directly:

const plan = await db.posts.explain({
  where: { orgId: 7 },
  orderBy: { createdAt: 'desc' },
});

For the rest, query events report every statement with its duration, so flagging anything over 200 ms is one line. A local metrics dashboard and OpenTelemetry traces build on the same hooks, with no hosted service.

Easy to move to from Prisma#

If you know Prisma, you already know most of Turbine. The query API is the same shape, and include becomes with:

// Prisma
await prisma.user.findMany({
  where: { role: 'admin' },
  include: { posts: true },
});
 
// Turbine
await db.users.findMany({
  where: { role: 'admin' },
  with: { posts: true },
});

You don't have to rewrite everything at once:

  • turbine migrate-from-prisma reads your schema.prisma and generates a typed Turbine client.
  • A Prisma compatibility adapter keeps PrismaClient-style call sites working while you port them one at a time.

Full guide: Migrate from Prisma. Coming from Drizzle? Migrate from Drizzle.

Safe by default#

  • Accidental mass updates are blocked. An update or delete with an empty or always-true where throws instead of touching every row.
  • Personal data stays out of your queries. Tag a column pii: true and Turbine leaves it out of every default read and write.
  • Destructive migrations ask first. Dropping a column or table needs an explicit confirmation, or --allow-destructive in CI.
  • Studio is read-only unless you start it with --write.

Free, with everything included#

MIT licensed, with no cloud tier, no account and no telemetry. Studio, doctor, the MCP server and observability all ship in the npm package.

Is Turbine right for you?#

Turbine fits best when you run Postgres and want speed, type safety and a small footprint.

It may not be the right pick if you need full migration tooling for SQLite, MySQL or SQL Server (the query API runs on those engines, but generate and migrate are Postgres-only), want a schema DSL like .prisma files, or need the largest community of answers online.

Try it#

npm install turbine-orm
npx turbine studio --demo   # explore a sample database, no setup needed