talira

SQL query builder for Node.js with migrations and seeds

open sourceMITfree

Knex.js is a SQL query builder for Node.js. It builds queries for PostgreSQL, MySQL and MariaDB, CockroachDB, Amazon Redshift, SQLite3, Oracle and SQL Server from one chainable API, with transactions, connection pooling, streaming queries, and both promise and callback interfaces. It also has a schema builder and a migrations and seeds CLI, and TypeScript types. It is not an ORM itself: ORMs such as Objection.js and MikroORM are built on it. It is MIT licensed and installs from npm.

Problems it solves

  • build SQL queries in Node.js without writing raw SQL strings
  • run database schema migrations in a Node.js project
  • write queries that work on both Postgres and SQLite from JavaScript

Features

  • Query builder for PostgreSQL, MySQL, MariaDB, CockroachDB, Redshift, SQLite3, Oracle and SQL Server
  • Schema builder
  • Migrations and seeds with a CLI
  • Transactions and connection pooling
  • Streaming queries
  • Promise and callback APIs

Alternatives

The same job

These do what Knex.js does.

  1. Kysely Type-safe SQL query builder for TypeScript
  2. Reylo Import .sql files into TypeScript with types inferred from your live database, plus SQL-first migrations

Compare Knex.js with the top 3