GraphQL.orgIf you’re not familiar with GraphQL, it’s a modern way of building APIs – think of it as an alternative to REST. GraphQL addresses many of the limitations of traditional REST APIs by enabling clients to specify exactly what data is needed; by making it easier to aggregate data from multiple sources, and by using a strict type system to describe data.
GraphQL makes the observation that your application data is a graph, and allows the client to query it as a graph.
What is the GraphQL Foundation?
“An open and neutral home for the GraphQL community to enable widespread adoption and help accelerate development and the surrounding ecosystem.” – https://foundation.graphql.org/The GraphQL Foundation is a neutral group set up to provide governance and vendor-neutral stewardship for GraphQL. This includes oversight of funding, operations and marketing resources for the GraphQL community.
The foundation is responsible for growing the GraphQL ecosystem by creating educational content and organizing events, as well as a technical advisory committee to help maintain the specification, tooling and reference implementations associated with GraphQL.
The founding members of the GraphQL Foundation include Neo4j, Apollo, AWS, IBM, Twitter, Hasura, Facebook, Intuit and Paypal. Together, this group will collaborate with the community to encourage more participation in the ecosystem and drive even wider use of GraphQL.
Making It Easier to Build Fullstack Applications with GRANDstack
GRANDstack overview. Our GraphQL integrations are part of GRANDstack (GraphQL, React, Apollo, Neo4j Database) – a framework for building fullstack applications with Neo4j. GRANDstack includes functionality for creating a GraphQL API backed by Neo4j, adding authorization rules, UI components from React and deployment options including leveraging serverless functionality for deploying both the front-end and backend.
We’ve created a GRANDstack starter project with all these features bundled together. Just download the project and start adding your functionality to get started.
Why Use GraphQL with Neo4j?
GraphQL makes the observation that your application data is a graph, and allows any client to query this data as a graph. While GraphQL can be used with any data layer, we think the best way to use GraphQL is with a graph database.
Using a graph database as the backend for a GraphQL service eliminates the mapping and translation layer that must be implemented when fetching data from other systems, as well as solving the n+1 query problem. This results in better performance and huge developer productivity wins.
We’ve been working on building integrations with Neo4j and GraphQL for almost three years now. These integrations make it easy to build a GraphQL API backed by Neo4j and follow these three principles:
- GraphQL type definitions drive the database schema and the API
- A single Cypher database query is generated from each GraphQL request
- Extend GraphQL with the power of Cypher through the use of @cypher schema directives
Use GraphQL type definitions to drive the database data model. This means you only need to maintain one schema, as defined by GraphQL type definitions, not one for the database and one for your API. This is the Schema First GraphQL development paradigm at work. A full CRUD GraphQL API is generated from these type definitions, including queries, mutations and resolvers (functions that contain logic for fetching data), which means there’s no need to write boilerplate code for reading or updating data.
A single Cypher query is generated from each GraphQL request. Many GraphQL server implementations end up making multiple round trip requests to the database for each GraphQL request, impacting performance. The Neo4j-GraphQL integrations can translate any arbitrary GraphQL request into a single Cypher query, which means a single round trip to the database and much better performance.
Extend GraphQL with the power of Cypher. Since GraphQL is an API query language and not a database query language it lacks semantics for certain operations such as aggregations, projections, and more complex traversal patterns. Through the use of GraphQL schema directives, Cypher queries can be used to add additional functionality to GraphQL fields.
This talk from GraphConnect 2018 shows these integrations in action:
The formation of the GraphQL Foundation is an important step to ensure GraphQL has the vendor neutral platform it needs to continue its rapid adoption in the future. We plan to keep investing in our GraphQL integrations and GRANDstack and can’t wait to see what the community keeps building with GraphQL.
Ready to try GRANDstack? Click below to begin your journey building fullstack graph applications with ease.
Go There Now
Go There Now