What is SQL to GraphQL Resolver Generator?
This tool converts SQL CREATE TABLE statements into GraphQL Schema Definition Language (SDL) and TypeScript resolver stubs. It automatically generates GraphQL types, Query and Mutation operations, and handles foreign key relationships by creating field resolvers.
How to Use
- Paste your SQL CREATE TABLE statements into the input area
- Click "Generate GraphQL" to create the schema and resolvers
- Switch between Schema SDL and Resolvers tabs to view different outputs
- Copy the output and integrate it into your GraphQL server project
Why Use This Tool?
Tips & Best Practices
- Foreign keys (REFERENCES) are converted to field resolvers for nested queries
- Primary keys are used for single-item queries (e.g., user(id: ID!))
- NOT NULL columns become required fields (!) in GraphQL schema
- Implement the TODO resolver functions with your database logic
- Customize the context parameter to include your data sources
Frequently Asked Questions
How are SQL types mapped to GraphQL?
INTEGER/SERIAL → Int, FLOAT/DECIMAL → Float, BOOLEAN → Boolean, TIMESTAMP/DATE → String, UUID → ID, VARCHAR/TEXT → String.
How are foreign keys handled?
Columns with REFERENCES are converted to field resolvers. For example, user_id REFERENCES users(id) becomes a user field that resolves to the User type.
What CRUD operations are generated?
For each table, Query: getOne(id), getAll. Mutation: create, update, delete. All operations include TypeScript resolver stubs.
Is my SQL schema sent to a server?
No, all processing happens entirely in your browser. Your SQL schema never leaves your device.