-
Notifications
You must be signed in to change notification settings - Fork 38
Description
TL;DR: I have a strong intuition that GraphQL and TypeDB would fit greatly together.
What is GraphQL?
GraphQL is an HTTP request pattern that is pretty interesting, albeit younger and less common than REST. It solves several shortcomings of REST by offering a more expressive and flexible request format. In fact, I think GraphQL maps more naturally to TypeDB concepts than REST. The fact that TypeQL was previously called Graql back in Grakn days is also worth a few seconds' thoughts. :)
Anyways. A backend server that provides a GraphQL API, just like a backend server that provides a REST API, stands between HTTP clients (i.e., frontend apps) and the persistence database, with resolution logic that maps HTTP requests into database requests, among other things.
Apollo Server, resolvers and connectors
One widespread implementation of a GraphQL server is Apollo Server, part of Apollo. Apollo Server is lightweight and quite flexible, allowing for any logic for read and write operations to the database. Such logic is written in components that Apollo calls "resolvers".
Due to the similarity between GraphQL and TypeDB concepts, I think it would be useful for developers to come up with a boilerplate implementation of resolvers that naturally translates the one into the other, while obviously allowing developers to override the default logic with their own as needed.
It also looks like Apollo offers a higher-level tool called "connectors", which I'm not quite familiar with, but it looks like it could be useful.
What can we do next?
@flyingsilverfin started to think about how nicely GraphQL could be used in front of a TypeDB model.
I think that having such a tool would make life much easier for web developers who wish to use TypeDB as their persistence layer, hence helping with adoption. I'm curious to know what ideas the community has about that and how we can expand on that idea.