knex
npmv3.3.0TypeScriptA batteries-included SQL query & schema builder for PostgresSQL, MySQL, CockroachDB, MSSQL and SQLite3
Overview
knex is an npm package that a batteries-included SQL query & schema builder for PostgresSQL, MySQL, CockroachDB, MSSQL and SQLite3. It is very popular, with about 4.4M downloads per week and 1 known dependents in the graph. The latest version is 3.3.0, released under the MIT license.
Who should use it
Teams working in the npm ecosystem who need a batteries-included SQL query & schema builder for PostgresSQL, MySQL, CockroachDB, MSSQL and SQLite3 and value a battle-tested, widely-adopted solution.
When not to use it
Consider an alternative if you need to minimize your dependency tree, or if a more actively-maintained option better fits your npm stack.
Pros
- Large, well-established user base (4.4M weekly downloads).
- Ships TypeScript type definitions.
- Clear open-source license (MIT).
Cons
- Large dependency tree (60 direct dependencies) increases install size and audit surface.
Auto-generated from collected registry metadata. No external claims are inferred.
Relationship graph
Dependencies (left) and dependents (right) of knex.
Dependencies
Runtime (14)
Peer (1)
Dev (45)
Used by
Popular packages that depend on knex.
Alternatives to knex
Type safe SQL query builder
Drizzle ORM package for SQL databases
Fastest full featured PostgreSQL client for Node.js
PostgreSQL client - pure javascript & libpq with the same API
sql named placeholders to unnamed compiler
The fastest and simplest library for SQLite in Node.js.
Mongoose MongoDB ODM
🛡️ Faster SQL escape and format for JavaScript (Node.js, Bun, and Deno).
Asynchronous, non-blocking SQLite3 bindings
PGlite is a WASM Postgres build packaged into a TypeScript client library that enables you to run Postgres in the browser, Node.js and Bun, with no need to install any other dependencies. It is only 3.7mb gzipped.
Media Type Database
Connection pool for node-postgres
Frequently installed together
TypeScript definitions for pg
PostgreSQL client - pure javascript & libpq with the same API
fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS
Fastest full featured PostgreSQL client for Node.js
Type safe SQL query builder
Type definitions and documentation for Bun, an incredibly fast JavaScript runtime
The fastest and simplest library for SQLite in Node.js.
TypeScript typings for Cloudflare Workers
TypeScript definitions for better-sqlite3
Asynchronous, non-blocking SQLite3 bindings
libSQL driver for TypeScript and JavaScript
The official Node.js client library for Gel
Version history
| Version | Published | License |
|---|---|---|
| 3.3.0latest | 22 days ago | MIT |
| 3.2.10 | 2 months ago | MIT |
| 3.2.9 | 3 months ago | MIT |
| 3.2.8 | 3 months ago | MIT |
| 3.2.7 | 3 months ago | MIT |
| 3.2.6 | 3 months ago | MIT |
| 3.2.5 | 3 months ago | MIT |
| 3.2.4 | 3 months ago | MIT |
| 3.2.3 | 3 months ago | MIT |
| 3.2.2 | 3 months ago | MIT |
| 3.2.1 | 3 months ago | MIT |
| 3.2.0 | 3 months ago | MIT |
| 3.1.0 | 2 years ago | MIT |
| 3.0.1 | 2 years ago | MIT |
| 3.0.0 | 2 years ago | MIT |
| 2.5.1 | 3 years ago | MIT |
| 2.5.0 | 3 years ago | MIT |
| 2.4.2 | 3 years ago | MIT |
| 2.4.1 | 3 years ago | MIT |
| 2.4.0 | 3 years ago | MIT |
Frequently asked questions
How do I install knex?
Run `npm install knex` to add knex to your npm project.
What license is knex released under?
knex is distributed under the MIT license.
How popular is knex?
knex has approximately 4,402,236 downloads per week and 1 known dependent packages.