
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
postgres-bridge
Advanced tools
postgres/pg compatibility layerWraps postgres API in a pg compatible API.
import postgres from 'postgres';
import { createPostgresBridge } from 'postgres-bridge';
const PostgresBridge = createPostgresBridge(postgres);
// pg.Pool Configuration
const configuration = {
host: 'localhost',
user: 'database-user',
max: 20,
idleTimeoutMillis: 30000,
connectionTimeoutMillis: 2000,
};
const pool = new PostgresBridge(configuration);
const connection = await pool.connect();
await pg.query('SELECT $1::text as name', ['foo']);
postgres is leaner/faster implementation of PostgreSQL protocol in Node.js than pg. However, postgres API is very different from the more broadly adopted pg client.
This package allows to adopt postgres without going through a painful migration. In particular, this compatibility layer has been designed to allow adoption of postgres using Slonik PostgreSQL client.
postgres-bridge was primarily developed to enable postgres use with Slonik PostgreSQL client. However, the scope has since been expanded to support several projects. It is now used in production by a handful real-world applications.
Known incompatibilities:
pool.connect()connection.processID not implementedpool._pulseQueue not implementedPlease submit PR if you require additional compatibility.
A basic benchmark shows no overhead as a result of using postgres-bridge:
pg query: 880ms
postgres query: 867ms
postgres-bridge query: 871ms
While these benchmarks do not show meaningful difference between pg and postgres, in production, in a large codebase, we noticed average response time improve by 30%. It means that in real-world scenarios, postgres overhead is significantly lesser than that of pg.
Running postgres-bridge tests requires having a local PostgreSQL instance.
The easiest way to setup a temporary instance for testing is using Docker, e.g.
docker run --rm -it -e POSTGRES_HOST_AUTH_METHOD=trust -p 5432:5432 postgres
FAQs
pg compatibility layer for postgres.
The npm package postgres-bridge receives a total of 138 weekly downloads. As such, postgres-bridge popularity was classified as not popular.
We found that postgres-bridge demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.