# Knex.js: 5.9 out of 10

Reasonable, with limits. 8th of 10 in [ORMs and query builders](https://elestia.ai/opensource/orms/index.md).

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

- **Overall: 5.9** (likely 4.8 to 7.0)
  - Claude Opus 5.5 (5.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.
  - GPT-6.2 Sol (6.8): 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.
- **Needed by many: 6.6** (likely 5.5 to 7.7)
  - Claude Opus 5.5 (7.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.
  - GPT-6.2 Sol (6.2): 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.
- **Helps a lot: 6.5** (likely 5.4 to 7.5)
  - Claude Opus 5.5 (5.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.
  - GPT-6.2 Sol (7.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.
- **Holds up over time: 5.5** (likely 4.0 to 6.9)
  - Claude Opus 5.5 (5.0): 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.
  - GPT-6.2 Sol (5.9): 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.
- **Used widely: 6.4** (likely 5.3 to 7.5)
  - Claude Opus 5.5 (6.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.
  - GPT-6.2 Sol (6.3): 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.
- **Vouched for: 6.9** (likely 5.8 to 7.9)
  - Claude Opus 5.5 (6.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.
  - GPT-6.2 Sol (7.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.
- **Safe: 6.1** (likely 5.0 to 7.3)
  - Claude Opus 5.5 (6.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.
  - GPT-6.2 Sol (5.7): 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.

## 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

- Downloads, 4 weeks: 28M
- In a year: ×2.5
- GitHub stars: 20k
- Commits, 12 months: 129
- Last npm release: Jun 2026
- Advisories, 24 months: 0
- Licence: MIT
- GitHub: https://github.com/knex/knex
- npm: https://www.npmjs.com/package/knex

Scores run from 0 to 10 and are the mean of the scores of AI reviewers (Claude Opus 5.5, GPT-6.2 Sol), made on 21 November 2026 from GitHub, npm, OSV, OpenSSF Scorecard, ecosyste.ms, Hacker News and Bluesky data and a web search. The ecosyste.ms count of repositories that use a project is far too low for projects that grew in the last few years, and some reviews quote it. Overall is the reviewers' own judgement for a new project today, not an average of the parts. An AI wrote them and can be wrong.
