Introduction

It seems that GraphQLarrow-up-right users could benefit from using graph databasesarrow-up-right and graph database users could benefit from using GraphQL. Thankfully, much has already been done to support this direction.

As part of the GRANDstackarrow-up-right project, Neo4jarrow-up-right has built a GraphQL-Endpoint extension named Neo4j-GraphQLarrow-up-right, which provides an auto-generated APIarrow-up-right and custom database procedures for updating the schema and running operations. They have also built the neo4j-graphql-jsarrow-up-right package, which converts GraphQL requests directly to Cypher requests and is especially useful when the Neo4j-GraphQL extension is not available for some endpoint.

The Apollo Platformarrow-up-right provides a variety of technologies that support working with GraphQL, including Apollo Server 2.0arrow-up-right and Apollo Linkarrow-up-right for composable networking.

Prismaarrow-up-right has developed a collection of GraphQL resourcesarrow-up-right. Their graphql-bindingarrow-up-right package makes it easier to use schema delegationarrow-up-right. They have also built the Prisma APIarrow-up-right, which supports nested mutationsarrow-up-right.

Goal

A central goal of this project is to use Neo4j graph databases and Apollo server and networking resources to support progressively enhancing a GraphQL API that draws from current developments within the GraphQL community and further explores using GraphQL with graph databases. Given that Neo4j uses a property graph model, it should be interesting to develop features that take advantage of relationship propertiesarrow-up-right.

Features

  • Augments your schema without needing to introspect your Neo4j-GraphQL HTTP endpoint and uses the ⚡ Bolt driver for all operations.

  • Allows using the @cypherarrow-up-right directive from Neo4j-GraphQL for computed fields, query types and mutations.

  • Generates the same query typesarrow-up-right generated by Neo4j-GraphQL and delegates them to your Neo4j instance to be processed by the extension. Supports the same query arguments first, offset, orderBy, and filter, similar to those found in the Prisma Query APIarrow-up-right.

  • Supports nested create and connect mutations like those in the Prisma Mutation APIarrow-up-right (update, delete, etc. in development).

  • Generates resolversarrow-up-right for query and mutation types with a @cypher directive, as well as all auto-generated types.

  • Supports a @uniquearrow-up-right field directive for node property constraintsarrow-up-right in Neo4j in order to make node selection more robust.

  • Adds a id: ID! @uniquearrow-up-right field (if not provided) to any type with a @model directive and uses the cuid arrow-up-rightpackage to generate id field values for all auto-generated creation mutations.

Contact

I find the possibility of using GraphQL with Neo4j graph databases very interesting because I'm interested in the underlying activity of people using graph theoretic resources to build up complex descriptions of the world. I'm very happy to see a lot of activity with these technologies and would love to support the development communities in any way I can.

If you want to work together or need help with something, feel free to email me at michaeldgrahams@gmail.com or reach out on LinkedInarrow-up-right or Twitterarrow-up-right.

Resources

Last updated