aicoolies logo
Knex.js logo

Knex.js

SQL query builder for Node.js

Share
open-sourceOpen Source
Visit Website →

Flexible SQL query builder for Node.js supporting PostgreSQL, MySQL, SQLite, Oracle, and MSSQL. Chainable API for constructing queries with parameterized bindings. Features schema builder, migration system, seed files, transaction support, and connection pooling. Foundation for ORMs like Bookshelf.js and Objection.js. One of the most established query builders in the Node.js ecosystem.

Knex.js is a batteries-included SQL query builder for Node.js that provides a flexible, portable, and expressive API for constructing and executing database queries. Rather than being a full ORM, Knex operates at a lower level of abstraction, giving developers fine-grained control over their SQL while still providing a convenient JavaScript interface. It supports PostgreSQL, MySQL, MariaDB, SQLite3, CockroachDB, MSSQL, Oracle, and Amazon Redshift, making it one of the most versatile query builders available for the JavaScript ecosystem.

Knex distinguishes itself with its fluent, chainable API that maps closely to SQL syntax, making it intuitive for developers who already know SQL. It includes a full-featured schema builder for creating and modifying tables programmatically, robust migration support for version-controlled schema changes, and seed files for populating databases with test data. Knex provides transaction support with savepoints, connection pooling for production workloads, both promise-based and callback interfaces, and streaming capabilities for handling large result sets efficiently.

Knex.js is ideal for Node.js developers who want more control over their SQL than a full ORM provides but still want the convenience of a query builder with migration support. It serves as the query-building foundation for higher-level ORMs like Bookshelf.js and Objection.js, and is commonly used in Express, Fastify, and Hapi applications. Knex is particularly popular among backend developers who prefer writing SQL-like code in JavaScript, need to support multiple database engines, or want a lightweight alternative to full-featured ORMs.

Pricing

Free

Platforms

Node.js

Categories

Tags

Use Cases

Alternatives

Kysely logo

Kysely

Type-safe SQL query builder for TS

Type-safe SQL query builder for TypeScript that provides auto-completion and compile-time type checking without the abstraction overhead of a traditional ORM. Write queries that map directly to SQL while getting full TypeScript inference from your database schema. Supports PostgreSQL, MySQL, and SQLite with migrations, transactions, and raw SQL escape hatches. Lightweight with zero dependencies. Ideal for developers who want SQL control with TypeScript safety. Growing Knex.js alternative.

open-sourceOpen Source
TypeORM logo

TypeORM

ORM for TypeScript and JavaScript

Full-featured ORM for TypeScript and JavaScript supporting Active Record and Data Mapper patterns. Works with PostgreSQL, MySQL, MariaDB, SQLite, Oracle, SQL Server, and MongoDB. Features decorator-based entity definitions, migrations, relations (one-to-one, many-to-many), lazy/eager loading, query builder, transactions, and caching. Supports both Node.js and browser runtimes. 34K+ GitHub stars. Mature but losing mindshare to Prisma and Drizzle for new TypeScript projects.

open-sourceOpen Source
Sequelize logo

Sequelize

Promise-based Node.js ORM

Mature, promise-based ORM for Node.js supporting PostgreSQL, MySQL, MariaDB, SQLite, and SQL Server. Features model definitions with validations, eager/lazy loading, transactions, migrations, raw queries, and lifecycle hooks. Supports soft deletes, scopes, and virtual fields. One of the oldest and most battle-tested Node.js ORMs, widely used in enterprise apps though increasingly succeeded by Prisma and Drizzle in new projects.

open-sourceOpen Source

Related Tools

VectorChord logo

VectorChord

High-recall Postgres vector search at billion scale

VectorChord is a Postgres extension from the supervc-stack/VectorChord project that brings high-recall vector search to PostgreSQL. As the spiritual successor to pgvecto.rs, it combines IVF indexes with RaBitQ quantization to deliver Pinecone-class performance at billion-vector scale while keeping all data inside a single Postgres database — no separate vector store, no two-system sync, no rewrites when the workload grows.

open-sourceOpen Source
Infinity logo

Infinity

AI-native database for hybrid RAG retrieval

Infinity is an AI-native database from InfiniFlow that unifies dense vectors, sparse vectors, tensors, and full-text search in a single engine. Built for retrieval-augmented generation (RAG) at scale, it powers hybrid search workflows where lexical matching, semantic similarity, and reranking all happen against one storage layer instead of four loosely coupled services.

open-sourceOpen Source
sqlite-vec logo

sqlite-vec

Vector search extension for SQLite that runs anywhere

sqlite-vec is a lightweight vector search extension for SQLite written in pure C with zero dependencies. It brings nearest-neighbor search capabilities directly into SQLite databases, enabling AI applications to store and query embeddings without running a separate vector database. The extension works everywhere SQLite runs including Linux, macOS, Windows, WebAssembly in browsers, and even Raspberry Pi devices. Sponsored by Mozilla Builders, Fly.io, and Turso.

freeOpen Source
WeKnora logo

WeKnora

Enterprise RAG framework by Tencent

WeKnora is a Tencent-developed LLM-powered knowledge management and Q&A framework for enterprise document understanding and semantic retrieval. Supports 10+ document formats including PDF, Word, Excel, and images with seamless IM platform integration for WeCom, Feishu, Slack, and Telegram. Offers Quick Q&A mode using RAG pipelines and Intelligent Reasoning mode with ReACT agents for complex multi-step reasoning tasks across organizational knowledge bases.

open-sourceOpen Source
Pixeltable logo

Pixeltable

Declarative multimodal AI data infrastructure

Pixeltable is a declarative data infrastructure for multimodal AI that stores video, audio, images, and documents as first-class column types. Define Python computed columns for inference and transformations, and Pixeltable auto-orchestrates execution with incremental updates. Built-in vector search eliminates the need for separate vector databases while supporting RAG and semantic search workflows.

open-sourceOpen Source
USearch logo

USearch

Fast embeddable vector search engine

USearch is a high-performance vector search engine implementing HNSW algorithms for approximate nearest neighbor queries across C++, Python, JavaScript, Rust, Java, Go, and more. It supports user-defined distance metrics, memory-mapped persistence for datasets larger than RAM, and filtered search with predicates. Used by YugabyteDB and ScyllaDB as their production vector indexing backend.

open-sourceOpen Source