What does HackerNews think of node-postgres?

PostgreSQL client for node.js.

Language: JavaScript

#18 in PostgreSQL
#22 in PostgreSQL
One thing that keeps coming up is that SQL equals low productivity. I don't think this is true. I think the culprit is that most developers are using to heavily abstracting SQL using ORMs like Prisma that hides the database and SQL logic.

Since building a SQL generator (https://aihelperbot.com) as a side project, I have become much more proficient in SQL and even though I am also locked into Prisma, I use the `queryRaw` all the time to execute raw SQL queries. You can understand the code without knowing Prisma API. It is more performant. For more complex SQL queries, I use the SQL generator for initial suggestions and adapt if needed.

For the next projects I build I want to use the minimal Postgres client (https://github.com/brianc/node-postgres) combined with a lightweight migration library.

Great to see this package here. We have been using slonik for over a year now with few regrets. I am not a fan of query builders. Query builders work for simple inserts or updates. For really complex queries, nothing beats writing SQL inside of the sql template tag.

Another nice thing about slonik is that it is built on top of https://github.com/brianc/node-postgres. One gets all the benefit of node-pg with the nicer dev experience of slonik.

Yes there's connection pooling. But it's handled by the underlying PG library https://github.com/brianc/node-postgres that Massive is based on.
I'm a big fan of ORMs in other ecosystems (Rails and Django, for example), but in node I like to write more functional-style code, composing small modules into larger applications.

For this, check out the fantastic node-postgres adapter from brianc as well as his node-sql package for authoring SQL statements.

https://github.com/brianc/node-postgres\nhttps://github.com/brianc/node-sql

Mongo - Sure. I'm hardpressed to find genuine reasons to use MongoDB these days. Postgres provides everything I need in a persistent data store and has a ton of other stuff I didn't know I'd need (till you do!). Mongo was great to use with something like node.js where the async/schema-less model translates perfectly but using Postgres with the async driver[1] isn't bad either. Add in hstore, JSON support, plV8 ... and what exactly would somebody use Mongo for? :D

Redis - No clue what you're saying here. If you're using Redis then you're keeping your data in memory and dealing with low level structures. It's for completely different use cases. A classic example is rate limiting for an API. Doing it in Postgres with a disk I/O per request would cripple any semi-popular API. The data doesn't need to be exactly persistent (if we miss a few updates due to the server crashing we don't really care). In exchange for that it's blazing fast for individual writes that we can batch together to backup to something like Postgres (or Redis's built in persistence like AOF).

[1]: https://github.com/brianc/node-postgres

I just found node-postgres and it looks okay. Active development and issues look like they're not major. Do you have any experience with it?

https://github.com/brianc/node-postgres

EDIT:

Whoops, its clearly just a client and not an ORM. How about

https://github.com/dresende/node-orm2

instead?