Neo4j GraphQL Library
Frequently Asked Questions

Introduction

What is the Neo4j GraphQL Library?

The Neo4j GraphQL Library is a library for developing GraphQL API applications that uses Neo4j as the database layer. The library targets node.js GraphQL server implementations.

Product

What are the benefits of the Neo4j GraphQL Library?

Benefits of the Neo4j GraphQL Library:

  • Schema-first paradigm avoids duplicate schema work
  • Auto-generation of resolvers to simplify a lot of boilerplate code
  • Nested mutations for efficient transactions
  • Extensibility to include your own custom business logic in resolvers
  • Access to the power of Cypher query language in GraphQL
  • Built-in Auth to start with a secure API from the beginning

What are the benefits of using a Neo4j graph database with the Neo4j GraphQL Library?

Benefits of the Neo4j graph database:

  • Native graph model mapping for the “graph” in the GraphQL schema
  • Use of relationship pointers to quickly traverse recursive or variable length paths that are difficult to impossible in non-graph data models
  • High query performance, especially for connected data queries that would require complex joins in relational databases
  • Power of Cypher query language to eliminate unnecessary database calls (aka, the “n+1 problem”)

Why use the Neo4j GraphQL Library?

  • The library translates GraphQL queries into a single Cypher query. Developers using this library can focus solely on building applications while writing minimal backend code – the library handles the rest.
  • The library simplifies modernizing applications for exceptional performance, business results, and user engagement. Developers can create predictive, mission-critical, and context-aware apps with data-rich APIs that are more secure (using Auth) and reliable.
  • The library generates Cypher from GraphQL, GraphQL CRUD API from type definitions, auto-generated resolvers, and custom logic with @cypher schema directive. The library also comes with powerful authorization to secure your GraphQL API, nested mutations, and an OGM (Object-Graph-Mapper).
  • The library has a low learning curve, helping developers quickly build API-driven applications across open source frameworks (React, Vue, Angular, and Others) and achieve exceptional flexibility to deploy across on-prem, cloud, or in a serverless setup.

How can I get access to the Neo4j GraphQL Library?

The Neo4j GraphQL Library is available from NPM at @neo4j/graphql. Simply require it as a package dependency in your server-side JavaScript code.

How is the Neo4j GraphQL Library different from neo4j-graphql.js that was available with GRANDstack?

  • The Neo4j GraphQL Library (aka @neo4j/graphql) is an officially supported product of Neo4j. It has a dedicated product engineering team that works on improvements, updates, and fixes on a regular basis. The neo4j-graphql.js library was developed in Neo4j Labs as an experimental integration set out to validate new use cases and technologies. As such, it did not offer any guarantee of improvements and updates and was only developed on an ad-hoc basis. Neo4j-graphql.js is no longer maintained or supported, and the GRANDstack framework now uses the Neo4j GraphQL Library (@neo4j/graphql).
  • In terms of features, the Neo4j GraphQL library offers powerful authorization, nested mutations, and the OGM. You can read more about these features and other details on the differences here.

What Neo4j graph database versions does the GraphQL Library work with?

  • Neo4j 4.1 and above, Community and Enterprise edition downloads, Docker and cloud marketplace images and with the Neo4j Aura, a fully managed graph database as a cloud service.

I am looking for a Java implementation for GraphQL. Does the Neo4j GraphQL Library support Java, or can I use something else?

  • The Neo4j GraphQL Library targets JavaScript API implementations. We found the JavaScript implementations to be more common within the GraphQL ecosystem and have started with an official Javascript-based product first.
  • In case you have to implement for Java, there is neo4j-graphql-java available as a Neo4j Labs project. Please keep in mind that it is not an official product and does not enjoy the same benefits of support, regular updates, and feature requests as provided by the official JavaScript library.

Deployment

What are common deployment patterns for GraphQL APIs built using the Neo4j GraphQL Library?

The Neo4j GraphQL Library enables developers to build GraphQL API layers using any JavaScript GraphQL implementation. This GraphQL API layer is commonly deployed as a Node.js web server, and the Neo4j data model is defined by a GraphQL schema. Inside auto-generated resolver functions, GraphQL queries are translated to Cypher queries and sent to a Neo4j database by including a Neo4j driver instance in the context object of the GraphQL request. Resolvers can be overridden by a custom resolver function implementation to allow for custom logic. Optionally, GraphQL fields can be resolved by a user-defined Cypher query through the use of the @cypher schema directive.

Licensing

What are the licensing terms for using Neo4j GraphQL Library?

The Neo4j GraphQL Library is licensed under a permissive open source license (Apache2) and is available via the npm package manager.

Support

What are the support options available for customers?

Official Neo4j support is available for customers with an Enterprise license, and for everyone else community support is available through the Neo4j community forums. Aura support is as suggested here.