Skip to content

fluidnotions/reverse-engineering-of-database-to-graphql-schema

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reverse Engineering Of Database To GraphQL Schema

Synopsis

This a semi-automated approach to creating a GraphQL schema from an existing database schema. Though manual coding was minimal and related to mapping custom db types to jpa entities. With this example database there were only 3 custom types.

Schema Generation Results

To explore the generated schema graphically use the GraphQL Voyager tool.
Copy the contents of the schema.graphql file and paste it into the tool.
It seems to provide an accurate representation of the relationships within the db schema.
It also provides inputs etc.

GraphQL Voyager

Tools

JPA Buddy

JPA Buddy is a plugin for IntelliJ that can create jpa entities and repositories from an existing db schema.

graphql-jpa-query

graphql-jpa-query is a library that can create a GraphQL schema from jpa entities and repositories. I've implemented the controller from one of the provided packages, and it's possible to access the data via GraphQL queries using a client such as Altair and pointing it at the endpoint http://localhost:8080/graphql.
An advantage to this is that on adding a new entity to the db schema, the GraphQL schema is automatically updated.
The github repository has hints of how to create mutations, and mentions support for subscriptions, but I haven't figured out how yet.

hypersistence-utils

hypersistence-utils is a library that provides database type mapping for jpa entities.

Example Database

dvdrental database schema

About

Reverse engineered from data schema, fully functional graphQL API (excluding mutations... to come)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages