Kysely TypeScript Interfaces to Prisma Model Converter

Convert type-safe Kysely TypeScript interfaces into canonical Prisma schema models and enums with automatic primary key and default mapping.

At a glance

Kysely to Prisma Model Converter is a free developer utility that transforms Kysely TypeScript table interfaces and union types into canonical Prisma schema models and enums. It unwraps Generated and ColumnType modifiers and maps scalar types 100% client-side in browser memory.

Universal Switcher:
From:
To:

100% Client-Side Kysely to Prisma Model Converter

Zero Server Uploads

Convert type-safe Kysely TypeScript table interfaces into canonical Prisma schema models and enums with automatic primary key and default unwrapping directly in your browser.

Local Sandbox
Presets:
0 tables

Kysely Wrapper Unwrapping

Accurately unwraps Kysely Generated<T> and ColumnType<S, I, U> wrappers into Prisma attributes like @default(autoincrement()), @default(now()), and @updatedAt.

Database Interface Mapping

Reads the root export interface Database table mappings, automatically attaching Prisma @@map("table_name") directives when database names differ from PascalCase models.

100% In-Browser Privacy

All parsing, AST analysis, and Prisma schema generation runs locally in your browser memory with zero network requests and zero server uploads.

Copied to clipboard!

Why Use This Kysely TypeScript Interfaces to Prisma Model Converter?

100% Client-Side Privacy: Your TypeScript interface definitions never leave your browser.
Kysely Modifier Unwrapping: Accurately strips Generated<T> and ColumnType<S, I, U> wrappers into Prisma @default attributes.
Enum to Prisma Enum: Converts TypeScript string union types into clean Prisma enum declarations.
Database Interface Mapping: Resolves table name mappings from Database interface into Prisma @@map directives.
Clean Formatting & Header Generation: Includes optional datasource and client generator blocks with aligned columns.

How to Use Kysely TypeScript Interfaces to Prisma Model Converter

1

Input Kysely Interfaces

Paste your Kysely TypeScript database interfaces and union types or load a preset.

2

Configure Output Options

Select your target datasource provider, ID strategy (autoincrement, uuid, cuid), and suffix stripping.

3

Copy or Download Prisma Schema

Copy the converted Prisma schema directly to your clipboard or download as schema.prisma.

Kysely to Prisma Model example

Demonstrates converting a Kysely UserTable interface into a canonical Prisma model with autoincrement primary key, nullable name, and default timestamp.

Sample Kysely Interface Source
import type { Generated } from 'kysely';

export interface UserTable {
  id: Generated<number>;
  email: string;
  name: string | null;
  createdAt: Generated<Date>;
}
Generated Prisma Schema Processed
model User {
  id        Int      @id @default(autoincrement())
  email     String
  name      String?
  createdAt DateTime @default(now())
}

Technical Specifications & Engine Details

Technical specifications and engine details for Kysely TypeScript Interfaces to Prisma Model Converter
Specification Details
Supported Formats TYPESCRIPT, TEXT → PRISMA, TEXT
Execution Mode 100% Client-Side In-Browser (client)
Browser Requirements Modern browser with JavaScript enabled.
Performance Constraints Runs 100% client-side in browser memory. Performance and file limits are bounded by available local device RAM.
Maintained by Pragyan Pahadi

100% Client-Side Privacy Guarantee

Your files remain strictly on your local device. Zero data is transmitted to external servers.

Frequently Asked Questions

How does the converter handle Kysely Generated<T> wrappers?
Generated<number> is converted into Int @id @default(autoincrement()), Generated<string> maps to String @id @default(uuid()), and Generated<Date> becomes DateTime @default(now()).
Are TypeScript union types supported as Prisma enums?
Yes. Types defined as string unions (e.g. type Role = 'USER' | 'ADMIN') are automatically transformed into native Prisma enum blocks.
Is my TypeScript code processed privately?
Yes. All parsing and conversion executes entirely within your browser memory. No data is ever transmitted to any remote server.

Methodology

This tool runs entirely in your browser. The example above shows a representative input and the result it produces.

Last updated .