GraphQL Schema to Kysely Interface Generator
Transform GraphQL types, fields, and relations into production-ready TypeScript Kysely table interfaces.
At a glance
GraphQL Schema to Kysely Interface Generator is a free developer utility that transforms GraphQL SDL type definitions into type-safe TypeScript Kysely table interfaces. It handles inverted nullability, synthesizes foreign keys from object relations, normalizes nested arrays, and generates a master Database interface 100% client-side in browser memory.
100% Client-Side GraphQL SDL to Kysely Interface Generator
Zero Server UploadsTransform GraphQL SDL types, fields, and relations into type-safe TypeScript Kysely table interfaces and a consolidated Database interface.
Inverted Nullability Mapping
GraphQL non-null fields (Type!) map directly to required TypeScript properties, while unadorned fields map cleanly to union null (type | null).
Relational Normalization
Nested array relation fields (e.g. posts: [Post!]!) are excluded from SQL table columns, and object references synthesize foreign key columns (e.g. author_id).
Consolidated Database Interface
Generates a master Database interface with pluralized table keys, ready for type-safe Kysely query builder instantiation.
Why Use This GraphQL Schema to Kysely Interface Generator?
How to Use GraphQL Schema to Kysely Interface Generator
Input GraphQL SDL
Paste your GraphQL SDL schema into the editor or upload a .graphql file.
Configure Options
Select primary key strategy, column naming convention (snake_case), and auto-timestamps.
Copy or Download
Copy the generated TypeScript Kysely interfaces or download database.ts.
GraphQL Schema to Kysely Interface Conversion example
Converts a GraphQL User type into a Kysely UserTable interface with Generated id, non-null name, and nullable bio.
type User {
id: ID!
name: String!
bio: String
}
import { Generated } from 'kysely';
export interface UserTable {
id: Generated<string>;
name: string;
bio: string | null;
}
export interface Database {
users: UserTable;
}
Technical Specifications & Engine Details
| Specification | Details |
|---|---|
| Supported GraphQL Constructs | type, enum, scalar (DateTime, JSON, UUID), object relations |
| Execution Mode | 100% Client-Side In-Browser (Zero server latency) |
| Nullability Mapping | Inverted (GraphQL ! required → TypeScript required, unadorned → | null) |
| Generated Output | TypeScript Kysely Interfaces (Table interfaces, Generated<T>, Database) |
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 GraphQL nullability map to Kysely TypeScript interfaces?
How are primary keys and auto-generated columns handled in Kysely?
How are GraphQL object and list relations handled for relational SQL databases?
Is any GraphQL schema data sent to external servers?
Methodology
This tool runs entirely in your browser. The example above shows a representative input and the result it produces.
Last updated .