Neo4j GraphQL
Neo4j-GraphQL is an integration that translates GraphQL to Cypher and allows for inclusion of Cypher in GraphQL through the use of @cypher
GraphQL schema directives. There are two versions of the integration available depending on the architecture of your application.

Overview
The primary goal of the Neo4j-GraphQL integrations are to make it easy to build powerful GraphQL APIs that leverage the Neo4j graph database.
Goals
- Improve developer productivity for building GraphQL APIs
- "Auto-generate" resolvers by translating GraphQL to Cypher
- Exposing Cypher through GraphQL to enhance the functionality of GraphQL
There are two versions of the Neo4j-GraphQL integrations: neo4j-graphql-js
and the Neo4j-GraphQL database plugin:
neo4j-graphql.js
neo4j-graphql.js
is a JavaScript library available on NPM that is designed to work with any of the JavaScript GraphQL server implementations (such as Apollo Server, GraphQL Yoga, etc).
It works by inspecting the resolveInfo
object passed to each GraphQL resolver to translate GraphQL to Cypher and handle the database call through a neo4j-javascript-driver
instance that is injected into the context.
Neo4j GraphQL Database Plugin
The Neo4j GraphQL database plugin is a plugin that extends Neo4j by serving a GraphQL endpoint directly from Neo4j.
Using the Neo4j GraphQL database plugin makes sense if you don't have other data sources for your GraphQL API, if you don't need to implement custom resolvers (beyond the custom logic of a @cypher
schema directive), and if your clients querying the database directly is acceptable for your architecture.
Resources
- Five Common GraphQL problems and how Neo4j-GraphQL aims to solve them. [Blog post].
- Neo4j GraphQL Developer page.
- Query Graphs with GraphQL Youtube video (Neo4j online meetup recording)