So you're tired of writing all manner of SQL scripts in dialects such as T-SQL, PL/SQL, PL/pgSQL, and others, and various flavors of the SQL standard itself.

Maybe you really need to support multiple SQL databases right now, or you want to write code that has some hope of being database-agnostic in the future.

And you don't particularly like the idea of an object-relational mapper (ORM) layer, at least for now.

If any of those criteria seem to fit your thinking, and you'd like to write your database queries and data seeding (DML) and/or schema migrations (DDL) in JavaScript, CoffeeScript, or TypeScript, then Knex.js is worth trying!

Knex.js Logo

Who Uses It?

You'll be in pretty good company if you use Knex.js (or its sister project Bookshelf.js that provides an ORM layer). For example, the Ghost Blogging platform uses Bookshelf.js.


You can visit the Knex.js site to learn more, but I also highly recommend the Pluralsight course "Data Access in Node.js Using Knex" by Carlos Saloio.

More Info

I also plan to write a number of additional blog posts about Knex.js myself, with a particular focus on TypeScript, so stay tuned!