Registry / database / kysely-prisma-postgres

kysely-prisma-postgres

JSON →
library0.1.0jsnpmunverified

A Kysely dialect that enables type-safe SQL queries over HTTP using Prisma Postgres (PPG). Version 0.1.0 is the initial release, with active development. Unlike local PostgreSQL connections, this dialect communicates via PPG's serverless HTTP API, making it suitable for edge and serverless environments. It requires Kysely ^0.28 and @prisma/ppg ^0.5, and is ESM-only with built-in TypeScript types.

npm install kysely-prisma-postgres
INSTALL
IMPORT
SIG · KYSELY-PRISMA-POST
K
kysely-prisma-postgres
databasejavascriptv0.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PPGDialect
import { PPGDialect } from 'kysely-prisma-postgres'
const { PPGDialect } = require('kysely-prisma-postgres')
ESM-only package; require() will throw ERR_REQUIRE_ESM
ppg
import { ppg } from '@prisma/ppg'
import ppg from '@prisma/ppg'
Named export, not default. Check @prisma/ppg documentation for correct import.
Kysely
import { Kysely } from 'kysely'
import Kysely from 'kysely'
Named export from Kysely, not default.

Shows how to initialize Kysely with PPGDialect, define a database schema interface, and run a simple select query.

import { ppg } from '@prisma/ppg'; import { Kysely } from 'kysely'; import { PPGDialect } from 'kysely-prisma-postgres'; interface Database { person: { id: string; name: string; }; } const db = new Kysely<Database>({ dialect: new PPGDialect({ ppg: ppg(process.env.PRISMA_POSTGRES_CONNECTION_STRING ?? ''), }), }); const people = await db.selectFrom('person').selectAll().execute(); console.log(people);
Debug
Known issues
breakingPPGDialect requires Kysely 0.28 or later
fix
Upgrade Kysely to ^0.28
affects: <0.28
breakingPPGDialect requires @prisma/ppg 0.5 or later
fix
Upgrade @prisma/ppg to ^0.5
affects: <0.5
breakingkysely-prisma-postgres is ESM-only; CommonJS require() will fail
fix
Use import syntax or enable ESM in your project
affects: >=0.1
gotchaPRISMA_POSTGRES_CONNECTION_STRING must be set to a valid PPG connection string
fix
Ensure the environment variable is set and correctly formatted
affects: *
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module not supported
Using require() instead of import
fix
Change const { PPGDialect } = require('kysely-prisma-postgres') to import { PPGDialect } from 'kysely-prisma-postgres'
TypeError: ppg is not a function
Importing ppg incorrectly (e.g., default import instead of named)
fix
Use import { ppg } from '@prisma/ppg'
Error: knex dialect must have an 'options' property
Using an older version of Kysely that is incompatible
fix
Upgrade Kysely to ^0.28
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
@prisma/ppgrequiredPrisma Postgres HTTP client - required to create the PPG instance
kyselyrequiredCore query builder - required to use the dialect
Agent activity
4 hits · last 30 days
node
4
Resources
kysely-prisma-postgres — npm install kysely-prisma-postgres · libregistry