PostgresJs: The Fastest full featured PostgreSQL client for Node.js and Deno

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • postgres

    Postgres.js - The Fastest full featured PostgreSQL client for Node.js, Deno, Bun and CloudFlare (by porsager)

  • If you're using parameterized queries, then you _have_ to use PostgreSQL's "Extended Query" flow, which is what most people would think of as a "prepared statement". This is hardly opinionated.

    But normally, you use an unnamed prepared statement and/or portal, which PG will clean up for you, essentially only letting you have one of those per session (what we think of as a connection).

    I agree that sentence didn't make any sense. So I looked at the code (1) and what they mean is that they'll use a named prepared statement automatically, essentially caching the prepared statement within PG and the driver itself. Which I agree, is opinionated!

    (1) The main place where the parse/describe/bind/execute/sync data is created is, in my opinion, pretty bad code: https://github.com/porsager/postgres/blob/bf082a5c0ffe214924...

  • slonik

    A Node.js PostgreSQL client with runtime and build time type safety, and composable SQL.

  • You can already use postgres with Slonik.

    https://github.com/gajus/slonik#user-content-slonik-how-are-...

    It is not going to be the default because it is way slower.

    https://github.com/gajus/slonik/actions/runs/6616647651

    Test node_version:18 test_only:postgres-integration is taking 3 minutes.

    Test node_version:18 test_only:pg-integration is taking 38 seconds.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • pgtyped

    pgTyped - Typesafe SQL in TypeScript

  • Perhaps not as featured as OP’s but I’ve found https://pgtyped.dev/ useful. Queries are written as SQL files, and pgtyped creates typed functions you call with query parameters.

  • Prisma

    Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB

  • 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/

  • StrikeDB

    Promisified server-side prepared statements for node mysqljs

  • my own, very opinionated way of doing this in nodejs was to wrap node-mysql in promises and then force myself to make it explicit when preparing a a query whether I want it to set up a prepared statement which returns a reusable handle or run directly. That requires tracking prepared statement names and key/values for each one.

    https://github.com/joshstrike/StrikeDB/blob/master/src/Strik...

  • mammoth

    A type-safe Postgres query builder for TypeScript. (by Ff00ff)

  • Super happy user of this [1] it's rather minimalistic but great.

    [1] https://github.com/Ff00ff/mammoth

  • neon-vercel-zapatos

    Example use of Neon serverless driver on Vercel Edge Functions with Zapatos

  • It should be, now that pg runs fine there. If it’s not, please file an issue!

    It also works with @neondatabase/serverless on platforms without TCP connections (though it’s on my TODO list to make this less fiddly): https://github.com/neondatabase/neon-vercel-zapatos

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • postgres-shift

    A simple forwards only migration solution for postgres.js

  • No but I'm using this simple forwards only little side library https://github.com/porsager/postgres-shift

  • postgres-benchmarks

    A set of benchmarks focusing on the performance of Postgres client libraries for Node.js

  • There's a link to a simple Benchmark right after the title.

    Here are two:

    https://github.com/porsager/postgres-benchmarks

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

  • imdbench

    IMDBench — Realistic ORM benchmarking

  • pitwall-pg

    A postgres library to help write safe, parameterized, transaction-aware SQL for when an ORM or query builder isn't the right tool for the job

  • And my own similar version https://github.com/hagerty-dev/pitwall-pg

  • moebius

    A functional query tool for Elixir (by robconery)

  • If you like ecto but want something closer to the metal (no need to define mapping), then check out https://github.com/robconery/moebius

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