Type safety problem of Knex query builder

This page summarizes the projects mentioned and recommended in the original post on reddit.com/r/node

Our great sponsors
  • Appwrite - The Open Source Firebase alternative introduces iOS support
  • SonarLint - Clean code begins in your IDE with SonarLint
  • Mergify - Automate your Pull Request with Mergify
  • Scout APM - Less time debugging, more time building
  • Knex

    A query builder for PostgreSQL, MySQL, CockroachDB, SQL Server, SQLite3 and Oracle, designed to be flexible, portable, and fun to use.

    Knex's TypeScript support is very weak. Type inference gets disabled in rather complex queries - even in simple joins. I want to have a strong type safety for response objects of my queries. My project size is "small-to-mid". Possible solutions in my mind:

  • kysely

    A type-safe typescript SQL query builder

    If you like knex checkout kysely. It's basically knex built on typescript https://github.com/koskimas/kysely

  • Appwrite

    Appwrite - The Open Source Firebase alternative introduces iOS support . Appwrite is an open source backend server that helps you build native iOS applications much faster with realtime APIs for authentication, databases, files storage, cloud functions and much more!

  • pgtyped

    pgTyped - Typesafe SQL in TypeScript

    If you would like to use raw SQL, pgtyped looks rather interesting although it only supports postgres. https://github.com/adelsz/pgtyped

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts