Log in to GraphQL Editor
Neo4j GraphQL Library 2.0.0
Michal

Michał Tyszkiewicz

9/26/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:
https://www.youtube.com/watch?v=Ww3XclhuaaU

Check out our other blogposts

TypeScript enums in 5.0 (are they still bad?)
Michał Tyszkiewicz
Michał Tyszkiewicz
TypeScript enums in 5.0 (are they still bad?)
7 min read
11 months ago
What can GraphQL do for your API?
Carl Matte
Carl Matte
What can GraphQL do for your API?
3 min read
almost 4 years ago
GraphQL Hello World app with GraphQL Editor and Stucco.js
Arkadiusz Kuryło
Arkadiusz Kuryło
GraphQL Hello World app with GraphQL Editor and Stucco.js
4 min read
5 months ago

Ready for take-off?

Elevate your work with our editor that combines world-class visual graph, documentation and API console

Get Started with GraphQL Editor