I’m a big fan of postgres.js ( https://github.com/porsager/postgres ). It’s minial and straightforward but you have to know how to sql. In fact I don’t really like ORMs. Most of the time I feel it makes things over complicated for nothing and I’ll never use any other databases than postgres. Dev mode included. As everyone should in my opinion (trying to get each environements the same for testing/debuging purpose is a hughe plus). Moreover it’s fast. Answer from Deleted User on reddit.com
🌐
node-postgres
node-postgres.com › apis › client
node-postgres
1 month ago - When the client is in the process of connecting, dispatching a query, or disconnecting it will catch and forward errors from the PostgreSQL server to the respective client.connect client.query or client.end promise; however, the client maintains a long-lived connection to the PostgreSQL back-end and due to network partitions, back-end crashes, fail-overs, etc the client can (and over a long enough time period will) eventually be disconnected while it is idle.
🌐
GitHub
github.com › brianc › node-postgres
GitHub - brianc/node-postgres: PostgreSQL client for node.js. · GitHub
Non-blocking PostgreSQL client for Node.js (and bun, deno, cloudflare, etc...).
Starred by 13.2K users
Forked by 1.3K users
Languages   JavaScript 79.4% | TypeScript 19.6%
Discussions

Which postgreSQL node.js client library to choose today?
I’m a big fan of postgres.js ( https://github.com/porsager/postgres ). It’s minial and straightforward but you have to know how to sql. In fact I don’t really like ORMs. Most of the time I feel it makes things over complicated for nothing and I’ll never use any other databases than postgres. Dev mode included. As everyone should in my opinion (trying to get each environements the same for testing/debuging purpose is a hughe plus). Moreover it’s fast. More on reddit.com
🌐 r/node
47
27
August 17, 2023
PostgresJs: PostgreSQL client for Node.js and Deno
No “fancy” and bleeding abstractions like something like Prisma, not convoluted type annotations like other TS libs, no, just plain SQL statements in the best JavaScript way of doing it · I discovered learning to do Postgres a couple years ago, after getting sick of trying to hack Prisma, ... More on news.ycombinator.com
🌐 news.ycombinator.com
143
308
October 23, 2023
Slonik, a popular Node.js PostgreSQL client, is now compatible with "postgres" client
New to web dev – do people mix Node.js with Python (e.g. for AI stuff)? ... I built an open-source web UI to self-host your PostgreSQL backups. More on reddit.com
🌐 r/node
10
31
August 2, 2022
Node.js with Postgresql Bad Practice
There's nothing wrong with writing raw queries, so long as you use proper parameter insertion (don't generate query strings using user input). Using an ORM is also an option, and there are a lot of decent options for TypeScript ORMs for Postgresql that others can recommend. These are unlikely to give you as nice of a developer experience as Mongoose, but I think Postgresql is a much better choice for production databases than MongoDB most of the time, and you can get close. More on reddit.com
🌐 r/node
22
9
January 6, 2022
🌐
npm
npmjs.com › package › pg
pg - npm
1 month ago - Non-blocking PostgreSQL client for Node.js.
      » npm install pg
    
Published   Jun 19, 2026
Version   8.22.0
🌐
Reddit
reddit.com › r/node › which postgresql node.js client library to choose today?
r/node on Reddit: Which postgreSQL node.js client library to choose today?
August 17, 2023 -

Raw queries, ORM, Query builder, code generators etc which pg client library would you choose with Node.js today in production?

Popular ones are: 1] Knex 2] Sequalize 3] TypeORM 4] Prisma 5] Drizzle 6] MikroORM

If you can also comment on "why" that would also be great. If there is any new recommendation that is also great

🌐
GitHub
github.com › porsager › postgres
GitHub - porsager/postgres: Postgres.js - The Fastest full featured PostgreSQL client for Node.js, Deno, Bun and CloudFlare · GitHub
Postgres.js - The Fastest full featured PostgreSQL client for Node.js, Deno, Bun and CloudFlare - porsager/postgres
Starred by 8.7K users
Forked by 355 users
Languages   JavaScript
🌐
npm
npmjs.com › package › postgresql-client
postgresql-client - npm
July 22, 2024 - import {Connection} from 'postgresql-client'; // Create connection const connection = new Connection('postgres://localhost'); // Connect to database server await connection.connect(); // Execute query and fetch rows const result = await connection.query( 'select * from cities where name like $1', {params: ['%york%']}); const rows: any[] = result.rows; // Do what ever you want with rows // Disconnect from server await connection.close();
      » npm install postgresql-client
    
Published   Jul 22, 2024
Version   2.13.0
🌐
Holt
sql.holt.courses › lessons › data › nodejs-and-postgresql
Node.js and PostgreSQL – Complete Intro to SQL
No worries if you don't have a ton of experience with Node.js · We are going to be using the pg package which is the most common PostgreSQL client for Node.js. There are others but this is the one with the most direct access to the underlying queries which is what we want.
Find elsewhere
🌐
This Dot Labs
thisdot.co › blog › connecting-to-postgresql-with-node-js
Connecting to PostgreSQL with Node.js - This Dot Labs
February 14, 2023 - You can use a connection pool or just instantiate a client. Here, we create both using credentials inside of the code itself. You can also configure connections with environment variables instead! This is an example index.js file that I put into a project I generated with npm init and installed node-postgres ...
🌐
npm
npmjs.com › package › node-postgres
node-postgres - npm
PostgreSQL client for node.js.
      » npm install node-postgres
    
Published   Jun 16, 2020
Version   0.6.2
🌐
DEV Community
dev.to › thisdotmedia › connecting-to-postgresql-with-node-js-k6k
Connecting to PostgreSQL with Node.js - DEV Community
June 25, 2024 - You can use a connection pool or just instantiate a client. Here, we create both using credentials inside of the code itself. You can also configure connections with environment variables instead! This is an example index.js file that I put into a project I generated with npm init and installed node-postgres ...
🌐
LogRocket
blog.logrocket.com › home › crud rest api with node.js, express, and postgresql
CRUD REST API with Node.js, Express, and PostgreSQL - LogRocket Blog
March 27, 2026 - node-postgres, or pg, is a nonblocking PostgreSQL client for Node.js. Essentially, node-postgres is a collection of Node.js modules for interfacing with a PostgreSQL database.
🌐
Stack Abuse
stackabuse.com › using-postgresql-with-nodejs-and-node-postgres
Using PostgreSQL with Node.js and node-postgres
March 6, 2020 - Then, let's use npm to install the node-postgres module, which will be used to connect to and interact with Postgres: ... With our project bootstrapped, let's go ahead and configure the database. After that, we'll write some basic CRUD functionality. As with all relational databases, we'll start off by creating one and connecting to it. You can either use the CLI or a GUI-based client to do this.
🌐
Hacker News
news.ycombinator.com › item
PostgresJs: PostgreSQL client for Node.js and Deno | Hacker News
October 23, 2023 - No “fancy” and bleeding abstractions like something like Prisma, not convoluted type annotations like other TS libs, no, just plain SQL statements in the best JavaScript way of doing it · I discovered learning to do Postgres a couple years ago, after getting sick of trying to hack Prisma, ...
🌐
Mako
mako.ai › guides › postgresql › connect-from-node
How to Connect to PostgreSQL from Node.js — Mako
June 12, 2026 - Node has two serious PostgreSQL clients: node-postgres (pg), the long-standing default that nearly every ORM builds on, and Postgres.js (postgres), a newer client built around tagged template literals and automatic pipelining. Both are production-grade.
🌐
Cuny
comet.lehman.cuny.edu › sfulakeza › su21 › ttp › slides › Day 11 › node-js-postgres-client.pdf pdf
node-postgres client (pg)
PostgreSQL:,Node.js,Client · 1 · Read%from%PostgreSQL%with%Node.js · //include the node postgres library · var pg = require('pg'); //connect to a database · pg.connect('postgres://user:password@localhost/my_db', function(err, client, done) { //request all of the hats ·
🌐
GitHub
github.com › panates › postgrejs
GitHub - panates/postgrejs: Professional PostgreSQL client for NodeJS · GitHub
PostgreJS is an enterprise-level PostgreSQL client for Node.js. It is designed to provide a robust and efficient interface to PostgreSQL databases, ensuring high performance and reliability for enterprise applications.
Starred by 67 users
Forked by 14 users
Languages   TypeScript 99.4% | JavaScript 0.6%
🌐
npm
npmjs.com › package › postgres
postgres - npm
April 5, 2026 - Fastest full featured PostgreSQL client for Node.js. Latest version: 3.4.9, last published: 3 months ago. Start using postgres in your project by running `npm i postgres`. There are 1149 other projects in the npm registry using postgres.
      » npm install postgres
    
Published   Apr 05, 2026
Version   3.4.9
🌐
Northflank
northflank.com › guides › connecting-to-a-postgresql-database-using-node-js
Connecting to a PostgreSQL database using Node.js — Northflank
November 25, 2021 - This script creates a Postgres client which allows you to run queries, adding and reading data to and from your database. In this example, a simple query which returns the input is run and printed to the console.
🌐
GitHub
github.com › fuxingZhang › postgres
GitHub - fuxingZhang/postgres: PostgreSQL client for node.js.
PostgreSQL client for node.js. Contribute to fuxingZhang/postgres development by creating an account on GitHub.
Author   fuxingZhang
🌐
ScaleGrid
help.scalegrid.io › docs › postgresql-connecting-to-nodejs-driver
Node.js PostgreSQL Connection
Install the PostgreSQL extension for Node.js npm install pg · Get the following PostgreSQL deployment information from your cluster details page: a. Username b. Password c. Hostname d. Port (default 5432) e. SSL certificate (if deployment has SSL) Run the following code to connect to you PostgreSQL deployment after you enter the information from step 2. ... const { Client } = require('pg') const client = new Client({ user: 'sgpostgres', host: 'SG-PostgreNoSSL-14-pgsql-master.devservers.scalegrid.io', database: 'postgres', password: 'password', port: 5432, }) client.connect(function(err) { if (err) throw err; console.log("Connected!"); });