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
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
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: