Overview
Knex.js was started in 2012 by Tim Griesser and is one of the most used SQL builders in Node.js. You write queries such as knex('users').join(...).select(...), define tables with a schema builder, and manage schema changes with its migration and seed CLI. It handles connection pooling, transactions and streaming, with both promise and callback APIs.
After version 3.1.0 in December 2023, releases paused until March 2026, when 3.2.0 arrived with migration lifecycle hooks and many fixes; 3.3.0 on 26 June 2026 added a MariaDB driver and knex.migrate.to. Several ORMs build on it, notably Objection.js, whose repository has seen little activity since 2025, and Bookshelf. MikroORM moved off Knex in version 7.
TypeScript typings are included, but types are not inferred from your schema the way Kysely does it, which is why many TypeScript projects now pick Kysely instead; the Knex author himself has praised Kysely as close to what he would build today.
Pricing and plans
| Plan | Price | What you get |
|---|---|---|
| Knex.js | $0 | MIT licence |
What it does
- Multi-dialect builder
- One API for PostgreSQL, MySQL, MariaDB, CockroachDB, SQL Server, SQLite and Oracle, including Oracle Wallet authentication.
- Schema builder
- createTable, alterTable and index helpers that emit dialect-specific DDL.
- Migrations and seeds
- CLI and API to create, run, roll back and target specific migrations, with lifecycle hooks since 3.2.
- Transactions and pooling
- Transaction helpers and a tarn.js connection pool, or bring your own pool since 3.3.
- Streaming
- Stream large result sets instead of loading them into memory.
Strengths and limitations
Strengths
- Mature and widely deployed, with many plugins and recipes
- Broad dialect coverage including Oracle and SQL Server
- Built-in migrations and seeds without an ORM
- Maintenance resumed with several releases in 2026
Limitations
- Result types are not inferred from the schema; TypeScript users must declare row types themselves
- Migrations are written by hand; there is no schema diffing
- Release activity paused from late 2023 to March 2026, and the issue tracker has hundreds of open issues
- Needs Node.js drivers, so it does not run on edge runtimes
Who it suits
Good for
- Existing JavaScript codebases that already use Knex
- Apps that need a query builder plus migrations on Oracle or SQL Server
- Projects using Objection.js
Look elsewhere if
- New TypeScript projects that want inferred result types (Kysely, Drizzle)
- Edge and serverless runtimes without Node.js drivers
Pricing history
-
Knex resumes releases with 3.2.0
Knex 3.2.0 was the first feature release since 3.1.0 in December 2023, adding migration lifecycle hooks and many fixes; 3.3.0 followed on 26 June 2026 with a MariaDB driver. Source ↗
Alternatives to Knex.js
| Tool | From | Free option | Stages |
|---|---|---|---|
| Ecto Elixir data mapping and query toolkit | — | ||
| Eloquent ORM Active Record ORM for Laravel | — | ||
| Active Record (Rails) Active Record ORM for Ruby on Rails | — | ||
| SQLAlchemy Python SQL toolkit and ORM | — | ||
| Drizzle ORM SQL-like TypeScript ORM | — | ||
| sqlc SQL-to-code compiler | — |
Questions
Is Knex still maintained?
Yes. After a pause, versions 3.2.0 (March 2026) and 3.3.0 (June 2026) were released with new features and fixes.
Knex vs Kysely: what is the difference?
Both are query builders; Kysely infers result types from a typed schema, while Knex relies on types you declare and includes a migration CLI.
Does Knex have migrations?
Yes, Knex includes a migration and seed runner with up and down functions that you write.
Sources read for this page