Knex
knex-types
Our great sponsors
Knex | knex-types | |
---|---|---|
94 | 8 | |
18,622 | 63 | |
0.9% | - | |
8.1 | 0.0 | |
2 days ago | 2 months ago | |
JavaScript | TypeScript | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Knex
-
Create a Blog web app using Adonis.js 6
AdonisJS core team has created/maintains Lucid. It is a SQL query builder, and an Active Record ORM built on top of Knex.
-
Type-safe Data Access in Go using Prisma and sqlc
Now, why not use an ORM? I've seen performance issues too many times with ORMs. I prefer writing my own SQL to avoid surprises. After all, I know the database schema and writing code for a specific purpose very often leads to better performance than generic code. ORMs have to support all kinds of database schemas. I only have to support mine. Having successfully used Knex.js in NodeJS (a popular query builder) in the past, I know writing SQL queries myself is not hard and provides very good performance.
-
Can I create another WordPress that satisfies humanity?
Given the dynamic nature of the schema, we employ Knex, a query builder, for database access.
-
What's wrong with Node.js ORMs? Thousands of issues? Why?
https://www.npmjs.com/package/knex - 779 issues
-
Credentials Leak with Knex
This article will be focused on a security issue that I found in Knex and how to mitigate it, but I'll also talk briefly about the social aspects of this problem.
-
Why SQL is right for Infrastructure Management
SQL is an old, irregular language to work with, but it is better known than HCL and SQL already has it's own Pulumi/CDK in the form of every ORM with introspection (like Javascript's Prisma, Python's Django, Go's XO etc) and QueryBuilder (LINQ, Knex, etc) in whatever programming language you prefer. You probably already know it.
- Help with SQL and Serialport
-
Kysely: TypeScript SQL Query Builder
How does HN receive SQL builders in general? I feel like most of us agree ORMs are typically a bad idea. I feel like that almost instantly leaves the need for "something" to take its place. In my experience, it's typically been a query builder like this.
I've also tried:
https://www.npmjs.com/package/sql-template-strings ("out of date" since like 2016? https://www.npmjs.com/package/sql-template-tag might be better)
Are query builders an anti pattern? People who are doing serious/logic heavy stuff with SQL, how do you avoid a query builder (if at all?)
-
Promises, Thenables, & Lazy-evaluation: What, Why, How
Of course, this is a trivial example that you probably won’t find in production code, but there are many projects that use lazy-evaluated Promise-like objects. Probably the most common example is with database ORMs and query builders like Knex.js or Prisma.
-
MagLit - Free and Open Source Link Shortener with Privacy, Encryption, Password Protection and more!
why not just use a mariadb or postgres docker image? heck, even sqlite should be fine, given the simplicity of your needs. i work with nodejs myself, i'd highly recommend knexjs for this- it's super flexible!
knex-types
-
What are popular ORMs for Node.js?
GraphQL.js + Knex.js + knex-types (TypeScript generator for Knex)
-
What database should i use with node.
And in order to have auto-complete and type checking, you can combine it with knex-types.
-
graphql-code-generator - how do I generate enums from TypeScript enums?
I generate TypeScript enums and types from the actual database schema using knex-types as part of the yarn db:reset script that used during local development (after making changes to the db schema migration files). See example project.
-
🔰🦸 Production-ready template for backends created with Node.js, Typescript and Express
I tried to take advantage of TypeORM in a couple of projects, but then reverted back to knex + knex-types — just a PostgreSQL client with query builder works great, IMO, especially for GraphQL API development.
-
Any Laravel Eloquent like ORM for node.js?
Nope. Just plain GraphQL.js + Knex.js (example), often typed manually since it's not where most of the time spend on when building an API server (though it can be automated via a scaffolding script if there are too many db tables). Generating TypeScript definitions off the actual db schema using knex-types (example).
-
Generate TypeScript definitions from PostgreSQL
Luckily, there is a solution! Assuming you have a database table that looks like this (Knex migration):
What are some alternatives?
Prisma - Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB
Sequelize - Feature-rich ORM for modern Node.js and TypeScript, it supports PostgreSQL (with JSON and JSONB support), MySQL, MariaDB, SQLite, MS SQL Server, Snowflake, Oracle DB (v6), DB2 and DB2 for IBM i.
pg-promise - PostgreSQL interface for Node.js
TypeORM - ORM for TypeScript and JavaScript. Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.
kysely - A type-safe typescript SQL query builder [Moved to: https://github.com/kysely-org/kysely]
slonik - A Node.js PostgreSQL client with runtime and build time type safety, and composable SQL.
kysely - A type-safe typescript SQL query builder
DataStax Node.js Driver for Apache Cassandra - DataStax Node.js Driver for Apache Cassandra
strapi-db-query-demo - Demonstrating database transactions in Strapi ✨
hjson-js - Hjson for JavaScript
MikroORM - TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL and SQLite databases.
Mongoose - MongoDB object modeling designed to work in an asynchronous environment.