Neo4j GraphQL Library 2.0.0

tomekponiat

Tomek Poniatowicz

Posted on September 27, 2021

Neo4j GraphQL Library 2.0.0

A while ago I wrote a bit about the GRAND stack, an integration of GraphQL, React, Apollo and the Neo4j Database. While working with the stack carries numerous benefits (and hey if you’re curious about those head on over and read about them here) it can be a bit overwhelming to get straight into it if you’re just starting out. So this time let's just look at the integration of the ‘G’ with the ‘N’ and with good reason as there is quite a bit of new stuff to check out there.

From GRAND to .js

The GRAND stack has made use of combining the strengths of the Neo4j database with GraphQL for a while, but the team at Neo4j wasn't resting on their laurels and has been hard at work to improve on the benefits of combining the two technologies. In 2018 they released a library neo4j-graphql.js, a GraphQL-to-Cypher based query execution layer for Neo4j and JavaScript GraphQL implementations. To put it short, something that gives you a fully functioning GraphQL API backed by Neo4j just by using type implementations from the GraphQL schema. The library was very useful and quite popular so it's not surprising they decided to build on that.

Beta and 1.0.0

In early april of 2021 the Neo4j team announced that after a year of hard work they’re releasing a beta of the Neo4j GraphQL library. Since then they’ve only picked up the pace with the full stable 1.0.0 release coming in that very same month. Even at just a glance the features look pretty enticing

  • Automatic query and mutation generation for CRUD interactions
  • Object Graph Mapper for programmatic interaction with your GraphQL API
  • node and relationship properties support
  • custom resolver support
  • multiple pagination options
  • authentication and authorisation options with additional access control options

Onto 2.0.0

Continuing with their blistering pace, neo4j dropped version 2.0.0 of their library on august tenth. While you could say that on the whole this library is a replacement or rather a continuation of the neo4j-graphql.js library with the sheer number of features it has far surpassed it. Aside from the usual stuff you can expect from a 2.0 update like bug fixes or performance improvements we have a few completely new features:

  • relationship properties: This is the star of the show, adding relationships to your type definitions provides way more context for your data. This way when fetching data you will have a much clearer picture than you would with just disconnected nodes. This solution combines rich and interconnected data with the transparency of GraphQL letting you easily build apps even when using quite complex data sets.

  • Cursor-based pagination: on relationship connected fields in your schema you’re able to use cursor-based pagination which is especially handy for infinitely scrolling apps

  • Count queries: if cursor based pagination is not your thing you can now use a simple query for counting all user nodes

GraphQL = easy on the eye

That’s not all, the update also provides improvements to union relationship fields, more comprehensive validation of type definitions and various bug fixes. On the whole the key thing is still utilizing how good GraphQL is at displaying even complex data and relationships is probably the best way to take full advantage of that. Even if that doesn't convince you, with how quickly the development is going on this particular library, you can be sure a lot of additional features will be added very soon.

Oh and make sure to check this video presenting Neo4j GraphQL Library in action:


A guest blog post for GraphQL Editor blog by Michał Tyszkiewicz


Speed up your GraphQL API development

GraphQL Editor is a supportive tool for both advanced GraphQL users as well as those taking their first steps with GraphQL APIs. Our all-in-one development environment for GraphQL will help you build, manage & deploy your GraphQL API much faster. Try GraphQL Editor for free!

Image description

💖 💪 🙅 🚩
tomekponiat
Tomek Poniatowicz

Posted on September 27, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related