
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
kysely-postgres-js
Advanced tools
kysely-postgres-js
offers a Kysely dialect for PostgreSQL that supports the Postgres.js client library (version >= 3.4) and Bun's (version >= 1.2) SQL native binding.
This dialect should not be confused with Kysely's core PostgreSQL dialect, which supports the significantly more adopted pg client library and Neon's WebSockets Pool instead. Both of these dialects are maintained by members of the Kysely core team and are production ready.
npm install kysely-postgres-js postgres kysely
pnpm add kysely-postgres-js postgres kysely
yarn add kysely-postgres-js postgres kysely
deno add npm:kysely-postgres-js npm:postgres npm:kysely
bun add kysely-postgres-js kysely
import { type GeneratedAlways, Kysely } from 'kysely'
import { PostgresJSDialect } from 'kysely-postgres-js'
import postgres from 'postgres'
interface Database {
person: {
id: GeneratedAlways<number>
first_name: string | null
last_name: string | null
age: number
}
}
const db = new Kysely<Database>({
dialect: new PostgresJSDialect({
postgres: postgres({
database: 'test',
host: 'localhost',
max: 10,
port: 5434,
user: 'admin',
}),
}),
})
const people = await db.selectFrom("person").selectAll().execute();
import { SQL } from 'bun'
import { type GeneratedAlways, Kysely } from 'kysely'
import { PostgresJSDialect } from 'kysely-postgres-js'
interface Database {
person: {
id: GeneratedAlways<number>
first_name: string | null
last_name: string | null
age: number
}
}
const db = new Kysely<Database>({
dialect: new PostgresJSDialect({
postgres: new SQL({
database: 'test',
host: 'localhost',
max: 10,
port: 5434,
user: 'admin',
}),
}),
})
const people = await db.selectFrom("person").selectAll().execute();
FAQs
Kysely dialect for PostgreSQL using the Postgres.js client
We found that kysely-postgres-js demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.