Live data from Hacker News

PostgresJs: PostgreSQL client for Node.js and Deno

github.com

21–30 of 148 posts

Re: PostgresJs: PostgreSQL client for Node.js and Deno

#21
post #5

I feel obliged to namedrop Zapatos here, another postgres JS client with a remarkably similar design (sql in template strings), but fully typesafe. If TypeScript is your thing, you might appreciate it: https://jawj.github.io/zapatos/ Personally I feel it’s one of the best designed (and documented) TS libraries out there and I’m sad it’s not very well known.

At first glance Zapatos doesn't appear to be Cloudflare workers compatible though I'd love to be corrected.

Re: PostgresJs: PostgreSQL client for Node.js and Deno

#22
post #4

I was wondering how old this project is: v1.0.1 - Jan 2020 v2.0.0 - Jun 2020 but never left beta. v3.0.0 - Mar 2022, which appears to be when the project really got started. I also wonder how solid it is, because it looks very interesting.

I've been using it in production (Deno) for a while. It's pretty solid, but their documentation is sorely lacking, so you often have to feel your way to getting more complex things to work.

Could you comment on what you're using deno in prod for? I'm curious to see and learn more about deno for production cases. I'm a big ts and nodejs user, and deno always seemed interesting to me. However I am afraid of being an early mover, so I like to learn more about use cases people have validated.

Re: PostgresJs: PostgreSQL client for Node.js and Deno

#23
post #20
post #17

Earlier quoted context omitted.

We had to abandon Zapatos because a) it doesn’t support multiple schemas; b) the types wouldn’t always be very readable. PgTyped was the alternative, and 2 years later I’m very glad we made the switch.

What do you mean multiple schemas ? What is an example of a non readable type?

Like this, it's pretty common way to use Postgres (with multiple schemas):

  CREATE SCHEMA a;

  CREATE SCHEMA b;

  CREATE TABLE a.foo (id SERIAL PRIMARY KEY);

  CREATE TABLE b.foo (id SERIAL PRIMARY KEY);

Re: PostgresJs: PostgreSQL client for Node.js and Deno

#24
post #17
post #5

I feel obliged to namedrop Zapatos here, another postgres JS client with a remarkably similar design (sql in template strings), but fully typesafe. If TypeScript is your thing, you might appreciate it: https://jawj.github.io/zapatos/ Personally I feel it’s one of the best designed (and documented) TS libraries out there and I’m sad it’s not very well known.

We had to abandon Zapatos because a) it doesn’t support multiple schemas; b) the types wouldn’t always be very readable. PgTyped was the alternative, and 2 years later I’m very glad we made the switch.

Ever try drizzle?

Re: PostgresJs: PostgreSQL client for Node.js and Deno

#25
post #8

For people who would like a more safe and structured approach (but almost as powerful and with the option to resort to SQL strings if needed) I highly recommend checking out Prisma https://www.prisma.io/

Prisma doesn't do JOINs [0], it just SELECTs everything and joins them in its own engine. It should not be taken seriously.

[0]: https://github.com/prisma/prisma/discussions/12715

Re: PostgresJs: PostgreSQL client for Node.js and Deno

#27
reposting my comment on its benchmarks:

On what makes it postgres.js faster, from author himself:

> it seems Postgres.js is actually faster than, not only pg, but of any driver out-there

- https://github.com/porsager/postgres/discussions/627

- https://porsager.github.io/imdbench/sql.html

Re: PostgresJs: PostgreSQL client for Node.js and Deno

#28
post #10

Also see: https://github.com/gajus/slonik

+1. I’m a happy user of slonik for several years. Zod integration is very useful

Totally agree. Slonik has had typed queries for some time now, but the integration with zod means that those types are verified at runtime. Incredibly useful with Typescript.

Re: PostgresJs: PostgreSQL client for Node.js and Deno

#29
post #8

For people who would like a more safe and structured approach (but almost as powerful and with the option to resort to SQL strings if needed) I highly recommend checking out Prisma https://www.prisma.io/

Prisma doesn't do JOINs [0], it just SELECTs everything and joins them in its own engine. It should not be taken seriously. [0]: https://github.com/prisma/prisma/discussions/12715

Are there no times this would be preferable? Just curious. It seems like the DX Prisma provides could potentially outweigh the need for joins, especially if you don’t have a ton of referentiality. I’ve been a very happy Prisma user for a couple years now and take it very seriously fwiw.
Post reply on HN