Skip to content

A tool to quickly generate GraphQL schemas and resolvers from a relational database

License

Notifications You must be signed in to change notification settings

oslabs-beta/TorchQL

Repository files navigation

PRs Welcome License: MIT

A developer tool to generate a GraphQL API from a known relational database.

What Is TorchQL?

TorchQL is an open-source tool to assist developers in the migration from REST APIs to GraphQL. It facilitates the task of exposing a GraphQL API over a relational database. In other words, you can use it to implement GraphQL in your application! Just visit our website here.

Our developer tool introspects an existing PostgreSQL or MySQL database and generates and returns GraphQL schema and resolvers. You can download these schema and resolvers to the desktop or let TorchQL assemble them in a lightweight zip package in the context of a real GraphQL API. After running your unzipped application, you can use GraphQL Playground, a built-in graphical interactive in-browser GraphQL IDE, to begin querying your database! You also have the additional option of opening up GraphQL Playground in your existing browser and testing your schema and resolvers immediately!

How It Works

TorchQL elegantly uses the metadata extracted from an SQL database to generate GraphQL custom types, queries, mutations, and resolvers. The schema and resolvers can be returned in either SDL or programmatic format and are downloadable as a single desktop file. For experienced users, TorchQL permits the custom editing of schemas and resolvers in the browser prior to download.

For a PostgreSQL database, enter your database address in the input box. For a MySQL database, enter your host, user, password, and database information. Then select either of the following formats for your GraphQL schema and resolvers:

  • As Schema Definition Language or SDL
  • As GraphQLSchema object or Programmatic

Click the Demo button if you would to use an existing PostreSQL database.

After entering your information, a new screen should appear displaying all your schema and resolvers properly formatted in a text editor.

SDL Example                                                                                  Programmatic Example

Click on the Back button to reenter your database information.

Click on the Save button to save your formatted schema and resolvers to the desktop.

Click on the Save/Test button to save your formatted schema and resolvers as a GraphQL server file in a folder on the desktop. See below for how you can test these schema and resolvers using GraphQL Playground.

Click on the Test button to open up GraphQL Playground in the browser and test your schema and resolvers right away!

How to Test Your Saved Schema and Resolvers:

  • Unzip package
  • Open directory
  • Install dependencies
npm install
  • Run application
npm start

Just follow the instructions in the console or enter localhost:3000/playground in your browser, and now you can begin querying your database!

Contributing

TorchQL is currently in beta release. We welcome all contributions & pull requests!

Authors

License

This project is licensed under the MIT License

About

A tool to quickly generate GraphQL schemas and resolvers from a relational database

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published