prisma-kysely is a Prisma generator that creates type definitions for Kysely from an existing Prisma schema. It currently stands at version 3.1.0 (published February 2026) and is actively maintained, with updates released to align with new Prisma major versions and introduce minor features. This package addresses the common developer desire to leverage Prisma's excellent schema definition and migration capabilities while utilizing Kysely for type-safe, expressive SQL query building, circumventing the limitations of the Prisma Client. It differentiates itself from alternatives like `kysely-codegen` by generating types directly from the Prisma schema file, eliminating the need for database introspection after migrations. This provides a more integrated and convenient workflow for keeping Kysely types synchronized with your database schema, ensuring full autocompletion and type safety for SQL queries. It's particularly useful for those seeking lean, serverless-ready setups without the Prisma Client's runtime footprint.
npm install prisma-kyselyVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to configure `prisma-kysely` in your `schema.prisma` file, then initialize Kysely using the generated types for type-safe database queries. It includes an example of a type-safe SQL query for fetching a user and their post count.
Update your `prisma` dependency to `7.0.0` or later. Ensure your Node.js version is `22.x` or newer. Review the Prisma 7.0.0 upgrade guide for details on moving your database URL configuration to `prisma.config.ts`.
Ensure your Node.js environment is compatible with Node.js 24 and update your `prisma` dependency to `6.10.1` or later.
Add a `banner` configuration to your `kysely` generator in `schema.prisma`. For example: `banner = """import type { Decimal } from 'decimal.js';"""`.Always check the `prisma-kysely` release notes and `package.json` for the exact `prisma` peer dependency range and ensure your installed `prisma` packages fall within that range. Upgrade or downgrade `prisma` as needed.
Install `prisma-kysely` using your package manager (`npm install prisma-kysely` or `bun add prisma-kysely`) and verify `generator kysely { provider = "prisma-kysely" }` in your `schema.prisma` file.In your `schema.prisma`, add a `banner` option to the `kysely` generator to include the necessary type import. Example: `banner = "import type { Decimal } from 'decimal.js';"`.Refer to the official Prisma 7.0.0 upgrade guide for instructions on configuring your database URL in `prisma.config.ts`.
Ensure that your `prisma-kysely` package and all `@prisma/*` packages (e.g., `@prisma/client`, `@prisma/generator-helper`) are updated to compatible versions, typically aligning with the `prisma-kysely` major version's supported Prisma version.