StackShareStackShare
Follow on
StackShare

Discover and share technology stacks from companies around the world.

Product

  • Stacks
  • Tools
  • Companies
  • Feed

Company

  • About
  • Blog
  • Contact

Legal

  • Privacy Policy
  • Terms of Service

© 2025 StackShare. All rights reserved.

API StatusChangelog
Knex.js
ByKnex.jsKnex.js

Knex.js

#68in Databases
Stacks184Discussions3
Followers406
OverviewDiscussions3

What is Knex.js?

Knex.js is a "batteries included" SQL query builder for Postgres, MySQL, MariaDB, SQLite3, and Oracle designed to be flexible, portable, and fun to use. It features both traditional node style callbacks as well as a promise interface for cleaner async flow control, a stream interface, full featured query and schema builders, transaction support (with savepoints), connection pooling and standardized responses between different query clients and dialects.

Knex.js is a tool in the Databases category of a tech stack.

Key Features

SQL query builder for Postgres, MySQL, MariaDB, SQLite3, and Oracle

Knex.js Pros & Cons

Pros of Knex.js

  • ✓Write once and then connect to almost any sql engine
  • ✓Faster
  • ✓Nice api, Migrations/Seeds
  • ✓Flexibility in what engine you choose
  • ✓Free
  • ✓Multi support and easy to use
  • ✓Simple query API

Cons of Knex.js

No cons listed yet.

Knex.js Alternatives & Comparisons

What are some alternatives to Knex.js?

Slick

Slick

It is a modern database query and access library for Scala. It allows you to work with stored data almost as if you were using Scala collections while at the same time giving you full control over when a database access happens and which data is transferred.

Spring Data

Spring Data

It makes it easy to use data access technologies, relational and non-relational databases, map-reduce frameworks, and cloud-based data services. This is an umbrella project which contains many subprojects that are specific to a given database.

DataGrip

DataGrip

A cross-platform IDE that is aimed at DBAs and developers working with SQL databases.

DBeaver

DBeaver

It is a free multi-platform database tool for developers, SQL programmers, database administrators and analysts. Supports all popular databases: MySQL, PostgreSQL, SQLite, Oracle, DB2, SQL Server, Sybase, Teradata, MongoDB, Cassandra, Redis, etc.

DB

DB

With DB you can very easily save, restore, and archive snapshots of your database from the command line. It supports connecting to different database servers (for example a local development server and a staging or production server) and allows you to load a database dump from one environment into another environment.

dbt

dbt

dbt is a transformation workflow that lets teams deploy analytics code following software engineering best practices like modularity, portability, CI/CD, and documentation. Now anyone who knows SQL can build production-grade data pipelines.

Knex.js Integrations

PostgreSQL, Oracle, MySQL, SQLite, Altibase and 4 more are some of the popular tools that integrate with Knex.js. Here's a list of all 9 tools that integrate with Knex.js.

PostgreSQL
PostgreSQL
Oracle
Oracle
MySQL
MySQL
SQLite
SQLite
Altibase
Altibase
Bookshelf.js
Bookshelf.js
IndexedDB
IndexedDB
Trails
Trails
Axe API
Axe API

Knex.js Discussions

Discover why developers choose Knex.js. Read real-world technical decisions and stack choices from the StackShare community.Showing 3 of 4 discussions.

Tim Nolet
Tim Nolet

CTO at Checkly Inc.

May 29, 2019

Needs adviceonPostgreSQLPostgreSQLHerokuHerokuHeroku PostgresHeroku Postgres

PostgreSQL Heroku Heroku Postgres Node.js Knex.js

Last week we rolled out a simple patch that decimated the response time of a Postgres query crucial to Checkly. It quite literally went from an average of ~100ms with peaks to 1 second to a steady 1ms to 10ms.

However, that patch was just the last step of a longer journey:

  1. I looked at what API endpoints were using which queries and how their response time grew over time. Specifically the customer facing API endpoints that are directly responsible for rendering the first dashboard page of the product are crucial.

  2. I looked at the Heroku metrics such as those reported by heroku pg:outlier and cross references that with "slowest response time" statistics.

  3. I reproduced the production situation as best as possible on a local development machine and test my hypothesis that an composite index on a uuid field and a timestampz field would reduce response times.

This method secured the victory and we rolled out a new index last week. Response times plummeted. Read the full story in the blog post.

0 views0
Comments
Tim Nolet
Tim Nolet

CTO at Checkly Inc.

Mar 1, 2019

Needs adviceonHerokuHerokuDockerDockerGitHubGitHub

Heroku Docker GitHub Node.js hapi Vue.js AWS Lambda Amazon S3 PostgreSQL Knex.js Checkly is a fairly young company and we're still working hard to find the correct mix of product features, price and audience.

We are focussed on tech B2B, but I always wanted to serve solo developers too. So I decided to make a $7 plan.

Why $7? Simply put, it seems to be a sweet spot for tech companies: Heroku, Docker, Github, Appoptics (Librato) all offer $7 plans. They must have done a ton of research into this, so why not piggy back that and try it out.

Enough biz talk, onto tech. The challenges were:

  • Slice of a portion of the functionality so a $7 plan is still profitable. We call this the "plan limits"
  • Update API and back end services to handle and enforce plan limits.
  • Update the UI to kindly state plan limits are in effect on some part of the UI.
  • Update the pricing page to reflect all changes.
  • Keep the actual processing backend, storage and API's as untouched as possible.

In essence, we went from strictly volume based pricing to value based pricing. Here come the technical steps & decisions we made to get there.

  1. We updated our @{PostgreSQL}|tool:1028| schema so plans now have an array of "features". These are string constants that represent feature toggles.
  2. The @{Vue.js}|tool:3837| frontend reads these from the @{vuex}|tool:6705| store on login.
  3. Based on these values, the UI has simple v-if statements to either just show the feature or show a friendly "please upgrade" button.
  4. The @{hapi}|tool:1166| API has a hook on each relevant API endpoint that checks whether a user's plan has the feature enabled, or not.

Side note: We offer 10 SMS messages per month on the developer plan. However, we were not actually counting how many people were sending. We had to update our alerting daemon (that runs on Heroku and triggers SMS messages via AWS SNS) to actually bump a counter.

What we build is basically feature-toggling based on plan features. It is very extensible for future additions. Our scheduling and storage backend that actually runs users' monitoring requests (AWS Lambda) and stores the results (S3 and Postgres) has no knowledge of all of this and remained unchanged.

Hope this helps anyone building out their SaaS and is in a similar situation.

0 views0
Comments
Wei Wei
Wei Wei

CTO at Flux Work

Oct 10, 2018

Needs adviceonKnex.jsKnex.js

Not an ORM but a query builder. So developers are encouraged or sometimes forced to think about SQL and database layer, which is a good thing. Knex.js

0 views0
Comments
View all 4 discussions

Try It

Visit Website

Adoption

On StackShare

Companies
40
DZIÁGE+34
Developers
150
LGSAAD+144