Knex.js
Reasonable, with limits. 8th of 10 ORMs and query builders.
Knex.js is a mature, multi-dialect SQL query builder for Node.js with built-in migrations, seeds and connection pooling. It is still solid, and other tools build on it. For new TypeScript work, Kysely or Drizzle give much stronger type safety, so Knex fits best where it already runs or where you need Oracle or SQL Server support.
Best for: JavaScript or mixed JS/TS teams that need a proven query builder with built-in migrations across many SQL databases, including Oracle and SQL Server.
Scores
Overall5.9
How strongly do we recommend it for a new project today?
Claude Opus 5.5: 5.0, likely 4.0 to 6.0
Knex is a reliable, well-known SQL query builder with strong migrations and the widest dialect support. Kysely now does the same job with far better types and faster maintenance, and Drizzle and Prisma lead new TypeScript projects. Maintenance has slowed and its growth trails the category. It is a reasonable pick for JS projects or Oracle and MSSQL needs, but most new TS projects should choose Kysely or Drizzle.
- betterstack.com/community/guides/scaling-nodejs/kysely-vs-knexjs: Kysely is preferred for TS-heavy work
- dev.to/_6638a39c349d7e9c85ee20/drizzle-orm-vs-kysely-vs-knexjs-2026-sql-query-builder-showdown-1a21: Knex is positioned as the veteran for existing codebases
- npm downloads ratio: About 2.5x, below the 4.1 median
- github pushedAt: No activity since June 2026
GPT-6.2 Sol: 6.8, likely 5.6 to 7.9
Knex is a good choice for JavaScript teams that want explicit SQL, broad dialect support, and built-in migrations. For most new TypeScript projects that want a query builder, Kysely’s stronger inference and more recent maintenance make it the better starting point. Knex’s continued use in major frameworks supports the recommendation, while the release pause and below-baseline download growth limit it.
- github.com/knex/knex/releases: 3.3.0 added MariaDB support and migration controls in June 2026.
- kysely.dev/docs/comparisons/kysely-vs-knex: Kysely provides stronger inference across ordinary queries and joins.
- reddit.com/r/node/comments/1t65wpr/from_knex_to_drizzle_or_prisma_looking_for: Developers considering a new TypeScript project point to Kysely as the closest typed alternative.
- github pushedAt, npm downloadsLast4Weeks, npm downloadsSame4WeeksYearAgo, medianDownloadsRatio, peers Kysely: Knex’s slower recent maintenance and relative growth weaken its case for new projects.
Needed by many6.6
How many developers need a tool for this job?
Claude Opus 5.5: 7.0, likely 6.0 to 8.0
Most backend JS/TS projects need database access, and many of them use SQL. Knex covers SQL databases only, but almost all of them. Because it is a query builder rather than a full ORM, it serves part of that group, which keeps it below the top band.
- github description: Supports PostgreSQL, MySQL, CockroachDB, SQL Server, SQLite3 and Oracle
- betterstack.com/community/guides/scaling-nodejs/kysely-vs-knexjs: Wide database support, including SQL Server and Oracle
GPT-6.2 Sol: 6.2, likely 5.0 to 7.3
Knex covers several of the most widely used relational databases and works with any Node.js framework. Its SQL-first approach fits a substantial share of backend work, while frontend-only projects, document databases, and teams that want an ORM fall outside its main audience. The database survey gives a strong signal about the databases people use and only an indirect signal about demand for a query builder.
- survey.stackoverflow.co/2026/technology/data: PostgreSQL, SQLite, MySQL, and SQL Server were all widely used by survey respondents.
- npmjs.com/package/knex?activeTab=readme: Documents Node.js support and the supported SQL dialects.
Helps a lot6.5
How well does it do the job for those who need it?
Claude Opus 5.5: 5.5, likely 4.5 to 6.5
The query builder, migrations, transactions and pooling are mature, and the dialect support is wide. The main limit is that its types are weak next to Kysely and Drizzle, so many errors only show up at runtime. That gap is the deciding factor for TypeScript projects today.
- betterstack.com/community/guides/scaling-nodejs/kysely-vs-knexjs: Knex has basic TS support added later; Kysely catches errors at compile time
- github.com/knex/knex/releases?page=1: 3.3.0 adds MariaDB, a connectionPool option and migrate.to; many dialect fixes
- docs.bswen.com/blog/2026-03-12-mikroorm-7-kysely-integration: A user reports that Knex types degrade to any on complex queries
- npm hasTypes: Bundled types
GPT-6.2 Sol: 7.4, likely 6.3 to 8.4
Version 3.3.0 combines a flexible SQL builder with migrations, transactions, streaming, and detailed examples. Kysely infers aliases and changing result shapes more reliably, giving teams and coding agents better compiler feedback on query edits. An independent benchmark found lower latency than Prisma in one older API workload, and an open PostgreSQL report describes a transaction cleanup failure, leaving performance and reliability across dialects less certain.
- knexjs.org/guide/query-builder: Documents the query API and where mutable builders lose type inference.
- knexjs.org/guide/migrations: Documents migration commands, rollbacks, and seed files.
- kysely.dev/docs/comparisons/kysely-vs-knex: Shows side-by-side inference for aliases, joins, and selected fields.
- j-ptiik.ub.ac.id/index.php/j-ptiik/article/download/15036/6677: Independent API load test found lower latency and CPU use for Knex in its workload.
- github.com/knex/knex/issues/6546: Open user report about a PostgreSQL connection returned to the pool after a transaction failure.
Holds up over time5.5
Will it still be a good choice in two years?
Claude Opus 5.5: 5.0, likely 3.5 to 6.5
The project shipped a burst of releases in March to June 2026, from 3.2.0 to 3.3.0, but there have been no pushes since June. The Scorecard Maintained check is 0, and there are 585 open issues and 191 open PRs. It has no visible funding, and the ecosystem is moving to typed builders: MikroORM 7 replaced Knex with Kysely. It is not abandoned, but the pace is slow.
- github pushedAt / commitsLastYear: Last push 2026-06-26; 129 commits in the last year
- scorecard Maintained: Score 0
- github openIssues/openPullRequests: 585 open issues, 191 open PRs
- github.com/knex/knex/releases?page=1: The ESM exports change in 3.2.0 was fixed and then reverted in 3.2.8
- docs.bswen.com/blog/2026-03-12-mikroorm-7-kysely-integration: MikroORM 7 moved to Kysely
GPT-6.2 Sol: 5.9, likely 4.5 to 7.3
Knex recorded 129 commits and nine GitHub releases over the year, with nearly five months since the last push by the review date. A reported TypeScript regression was fixed in about three weeks, while 585 issues and 191 pull requests remained open. Several maintainers contributed to releases and discussed a 4.0 roadmap, but future release timing and sustained funding are unclear. Kysely has a more recent release and more commits in the same period.
- github commitsLastYear, releasesLastYear, pushedAt, openIssues, openPullRequests: Annual activity was substantial, with a recent pause and a large backlog.
- github.com/knex/knex/releases: Shows multiple release contributors, a 2026 release burst, and fixes for module and typing regressions.
- github.com/knex/knex/issues/6452: Reported May 18 and closed with a fix June 9.
- github.com/knex/knex/issues/6409: Maintainers discuss potential breaking changes for 4.0.
- peers Kysely: 430 commits in the past year and a November release.
Used widely6.4
How many use it, and is that growing?
Claude Opus 5.5: 6.5, likely 5.5 to 7.5
Knex had 28M downloads in four weeks and about 95k dependent repos, so its installed base is large. Many of those downloads come through Strapi, Objection, Bookshelf and similar tools. Its yearly ratio is about 2.5, well below the 4.1 median, while Kysely and Drizzle grew 20x or more. It is losing share of new projects.
- npm downloadsLast4Weeks: 28.1M, against 11.3M a year ago (about 2.5x, below the 4.1 median)
- dependents repos: 94,868, more than Prisma or Drizzle
- peers Kysely/Drizzle downloads: 118M and 190M, both growing much faster
- bluesky posts: 0 posts, so little current attention
GPT-6.2 Sol: 6.3, likely 5.1 to 7.5
ecosyste.ms found about 95,000 dependent repositories, ahead of Prisma and TypeORM in this sample and behind Sequelize. Four-week npm downloads grew from 11.3 million to 28.1 million, or 2.48×, below the 4.1× catalog baseline and well below Kysely and Drizzle. Frameworks such as Strapi and Backstage bring indirect installs, so download counts give limited evidence about how many new projects choose Knex directly.
- dependents repos, packages: 94,868 indexed repositories and 3,407 npm packages declare a dependency.
- npm downloadsLast4Weeks, downloadsSame4WeeksYearAgo, medianDownloadsRatio: Downloads rose 2.48× against a 4.1× baseline.
- peers: Knex has an established installed base, with much slower download growth than Kysely and Drizzle.
- backstage.io/docs/backend-system/core-services/database: Backstage exposes Knex through its core database service.
- docs.strapi.io/cms/configurations/database: Strapi 5 uses Knex for database connections.
Vouched for6.9
Who stands behind it being good?
Claude Opus 5.5: 6.0, likely 5.0 to 7.0
Knex has long production use, and ORMs and CMSs such as Objection.js, Bookshelf, Strapi and Ghost are built on it. Current independent comparisons call it mature but steer new TypeScript projects to Kysely or Drizzle. Recent survey praise is missing.
- sitepoint.com/javascript-typescript-orms: Called the most mature JS SQL query builder; several ORMs use it
- dev.to/_6638a39c349d7e9c85ee20/drizzle-orm-vs-kysely-vs-knexjs-2026-sql-query-builder-showdown-1a21: A 2026 comparison recommends Knex for existing codebases and broad DB support
- Strapi, Ghost, Objection.js built on Knex: Widely deployed downstream tools
GPT-6.2 Sol: 7.7, likely 6.5 to 8.7
Strapi 5, Backstage, and Directus rely on Knex for core database access. That gives it several independent examples of real use, while MikroORM 7’s move away from Knex shows that some established users have changed direction. Evidence about current developer satisfaction and retention is thin.
- docs.strapi.io/cms/configurations/database: Strapi 5 documents Knex as part of its database layer.
- backstage.io/docs/backend-system/core-services/database: Backstage hands a Knex client to backend plugins for persistence.
- github.com/directus/docs/blob/main/content/configuration/database.md: Directus passes database connection settings to Knex.
- mikro-orm.io/blog/mikro-orm-7-released: MikroORM replaced Knex with its own query builder and Kysely as the runner.
Safe6.1
How safe is it to depend on?
Claude Opus 5.5: 6.5, likely 5.5 to 7.5
It is MIT licensed, and there have been no advisories in 24 months. The two older SQL-injection advisories, from 2019 and 2022, were fixed. The Scorecard is weak at 4.6: no security policy, unpinned dependencies, broad token permissions and partial code review. It pulls in 14 dependencies, which is moderate.
- advisories: 2 in total, none in the last 24 months
- scorecard score: 4.6; Security-Policy, Pinned-Dependencies and Token-Permissions all 0
- npm dependencies: 14 direct dependencies
- npm license: MIT
GPT-6.2 Sol: 5.7, likely 4.4 to 7.1
Both listed SQL injection advisories were patched before or around public disclosure, and OSV lists no new advisories in the past 24 months. The package has an MIT licence, 14 direct dependencies, and a GitHub Actions workflow that uses npm trusted publishing with provenance. OpenSSF scores it 4.6, with zeroes for workflow token permissions, dependency pinning, and a public security policy. Open reports involving Oracle and SQL Server leave uncertainty about the scope of remaining risk.
- npm license, dependencies: MIT licence and 14 direct dependencies.
- scorecard checks, advisories last24Months: Scorecard flags workflow and policy gaps, while OSV lists zero recent advisories.
- github.com/advisories/GHSA-58v4-qwx5-7f59: Records the fix in 0.19.5, released before public disclosure.
- github.com/advisories/GHSA-4jv9-3563-23j3: Records the fix in 2.4.0, released around public disclosure.
- github.com/knex/knex/pull/6441: Release workflow adopted npm trusted publishing with provenance.
- npmjs.com/package/knex?activeTab=readme: npm lists five package collaborators.
- github.com/knex/knex/issues: Lists open security reports for Oracle and SQL Server operations.
Good
- It supports more dialects than most peers: PostgreSQL, MySQL, MariaDB, SQLite, SQL Server, Oracle and CockroachDB.
- Its migration and seed system is mature, with batch rollbacks and, since 3.3, migrate.to and migrate.before.
- It has been in use for over a decade, with about 95k dependent repos and ORMs such as Objection.js and Bookshelf built on it.
- The API is small and close to SQL, and AI agents and developers write it easily from plenty of examples.
Bad
- TypeScript types were added later, and complex queries often fall back to any, unlike Kysely or Drizzle.
- Activity has slowed: there have been no commits since June 2026, and 585 issues and 191 PRs are open.
- The 3.2.x line shipped an ESM exports change that later releases had to fix and then revert.
- Downloads grow more slowly than the category median, and MikroORM 7 moved its SQL layer from Knex to Kysely.
The numbers
- npm downloads, 4 weeks
- 28M ×2.5 in a year
- GitHub stars
- 20k
- Commits, 12 months
- 129
- npm version
- 3.3.0 Jun 2026
- Versions, 12 months
- 12
- Advisories, 24 months
- 0 of 2 ever
- OpenSSF Scorecard
- 4.6 out of 10, Nov 2026
- Licence
- MIT
Read on 21 November 2026 from GitHub (knex/knex), npm (knex), OSV and the OpenSSF Scorecard.
ORMs and query builders
- 8.1Drizzle ORM
- 8.0Kysely
- 7.8Mongoose
- 7.5Prisma
- 7.3MikroORM
- 6.7ZenStack
- 6.4TypeORM
- 5.9Knex.js
- 5.3Objection.js
- 5.0Sequelize