What does HackerNews think of postgres?

Postgres.js - The Fastest full featured PostgreSQL client for Node.js and Deno

Language: JavaScript

#14 in Database
#23 in Node.js
#13 in PostgreSQL
#17 in PostgreSQL
This is an outdated take. The left-pad incident was 7 years ago, and newer mainstream packages are generally doing a better job curating dependencies.

That said, it is true that the Node/JS world is primarily hype-driven by "thought leaders" and people seeking personal brand and clout. Go on JS/React Twitter and prepare to loudly groan at the self importance on display.

There are good packages out there that try to do things in a sane way without wasting your time. Postgres.js [1] is one of them.

[1] https://github.com/porsager/postgres

there's also https://kysely.dev/

but personally i handwrite my queries with https://github.com/porsager/postgres for flexibility and performance

most orms use node-pg lib which has shit performance.

I don't think this should turn in to an ORM or not debate, but there are plenty of reasons, especially for the crowd that would do anything to avoid ORMs. Just try to take a peek into the multitude of "ORMs are bad" articles / discussions.

For instance - I would love to be able to use https://github.com/porsager/postgres with sqlite.

It's JS with the wonderful Postgres.js package!

[1] https://github.com/porsager/postgres

Here's an example where it really shines:

  const users = [
    { name: 'Murray', age: 68 },
    { name: 'Walter', age: 80 },
  ];

  await sql`insert into users ${ sql(users) }`;
They've looked at Postgres.js (https://github.com/porsager/postgres) before — wouldn't mind if they enabled those other cases in the same way.

Also, node-postgres is ripe for sql injections because you just concatenate strings yourself when using it...

Worse: Ecosystem

Better: Seamless TypeScript support without having to deal with 3rd party packages or tsconfigs. A standard library modeled after Go's that is a WIP, but solid overall. Having browser APIs in the runtime is great, removes the mental context switch between browser/node. Formatter built in to the binary. YMMV, but I prefer the url imports and lack of package.json.

I can't speak from a professional standpoint of migrating a project from Node to Deno; honestly, I don't think it's worth doing that (yet). But Deno is far more enjoyable to me as a hobbyist programmer and working on solo projects. I recently deployed an app backend using just the std and the Deno port of postgres.js[0] to Deno Deploy and it was a breeze.

I also think it's a great starting point for anyone looking to learn JavaScript.

[0] https://github.com/porsager/postgres

Not sure about ORM, but Postgres.js[0] works on Deno. For testing, Deno includes a built-in test runner and assertions via the std[1].

[0] https://github.com/porsager/postgres

[1] https://deno.land/manual/testing

>Same deal with Postgres. `pg` would not compile at all. Knex also didn't work (this was an older project).

You should take a look at Postgres.js [0] which supports Deno and TypeScript. Version 3.x was released recently and discussed in this HN thread [1].

The client is implemented in JavaScript. Queries can be written using JavaScript template literals.

[0] https://github.com/porsager/postgres [1] https://news.ycombinator.com/item?id=30794332

I built a safe PostgreSQL driver for node from scratch with zero dependencies in about 1200 lines. I did this mostly because of the plumbing required to make the goto node driver tolerable to work with. In the process I made it 4-5 times faster as well. https://github.com/porsager/postgres