A project template for using Apollo GraphQL with a Neo4j graph database.
The below technologies are necessary or recommended to get started with development:
- Install the Node.js runtime to use the JavaScript language for server programming
- Download Neo4j Desktop or the database version appropriate for your machine
- Install the Visual Studio Code editor
- Sign up for Apollo Studio to use their Explorer GraphQL IDE
Here is an evolving list of resources for learning more about the above technologies:
- 📘 Read
- GraphQL API language
- Why GraphQL?
- Server and Client resources from Apollo GraphQL
- Cypher graph query language
- GraphQL API language
- 🎥 Watch
- ☑️ Try
- Practical, hands-on trainings for learning GraphQL with Apollo Odyssey
- SpaceX GraphQL API
- GitHub GraphQL API
Schema files, a server file, and npm scripts exist for both the neo4j-graphql-js and @neo4j/graphql libraries. The /schema
directory for both contains a decomposition of the type definitions in this schema used by the GRANDstack Starter Kit.
-
neo4j-graphql-js
A GraphQL to Cypher query execution layer for Neo4j and JavaScript GraphQL implementations. -
@neo4j/graphql
Neo4j product beta of neo4j-graphql-js
Run npm install
in your terminal to install project dependencies. The following libraries are used to assist the development of Neo4j-GraphQL schemas:
-
graphql-tag
A JavaScript template literal tag that parses GraphQL queries. -
cypher-tag
A JavaScript template literal tag for Cypher in GraphQL. -
@graphql-workspaces/cli
A CLI for GraphQL workflow. -
@graphql-workspaces/load
A wrapper around the load-files and merge modules from graphql-tools used to load and merge schema files.
-
Modify the contents of the /schema directory.
-
Use the print command from @graphql-workspaces/cli to print the merged contents of the
/schema
directory to a schema.printed.graphql file next to it. Use the --watch or --validate arguments to watch for file changes or validate the merged type definitions.- Print:
gql print schema
- Watch:
gql print schema --watch
- Validate:
gql print schema --validate
- Print:
-
Use the below scripts to run the server file and start the API at localhost:4001/graphql or to print the result of the Neo4j-GraphQL augmentation of the merged type definitions in
schema.printed.graphql
. -
Add, modify, or rename any files or directories in
/schema
and repeat workflow.
You can print the result of the schema augmentation process from either neo4j-graphql library using the following scripts which use the gql
cli locally:
npm run print:neo4j-graphql-js
npm run print:neo4j-graphql
All other dependencies are used for building and running the server startup files with the following scripts:
npm run start:neo4j-graphql-js
npm run start:neo4j-graphql
- Add example operations for both neo4j-graphql-js and @neo4j/graphql that use nested mutations to seed the database.
- Provide the data available from https://cdn.neo4jlabs.com/data/grandstack_businesses.csv, similar to the GRANDstack Starter Kit, to each root mutation when pre-processing its argument values using a custom resolver function.
- Add examples of the authorization strategies available for neo4j-graphql-js and @neo4j/graphql.
- Use these utility functions from graphql-tools to support automated migration between integration libraries.
- Look into adding some functions from @graphql-inspector/core to such a process.