Warning: JavaScript is disabled on your browser. Parts of Neo4j.com will not work properly.

Neo4j & GRANDstack at GraphQL Summit [+Developer Challenge]

The Neo4j Developer Relations team is tasked with making sure developers can build applications backed by Neo4j using their favorite technologies. One technology we’ve been really excited about recently is GraphQL.

GraphQL is a relatively new paradigm for building APIs. You can learn more about GraphQL by reading this ref-card. The DevRel Engineering team has spent some time building integrations around GraphQL and Neo4j, and we’re happy to share them with you!

GraphQL Summit

Already in its second year, GraphQL Summit is a developer-focused conference showcasing how developers are using GraphQL. At GraphQL Summit, Will and Michael presented our integrations of GraphQL for Neo4j.

We really enjoyed the conference, and spoke to a lot of developers from startups and surprisingly a significant number of large companies that started to use GraphQL to unify their API landscape and make it easier to develop applications. The talks covered a wide range of uses, initiatives, problems and solutions around GraphQL. We were especially thrilled by topics around subscriptions, authentication and open source announcements and launches by IBM, Apollo and Graphcool.

One prominent theme at GraphQL Summit this year was on the ecosystem of tools being developed and made available to the community. This included a new release of the most popular GraphQL client, Apollo Client 2.0.

The 2.0 release makes Apollo Client more modular, allowing for more customization and incremental adoption. Apollo Client includes integrations with many frontend frameworks, including React. You can see an example of Apollo Client 2.0 as part of a simple GRANDstack app here. Apollo also demonstrated Engine, their tool for performance tracing, schema management, error tracking and caching.

We unveiled an early version of neo4j-graphql-js, a JavaScript library that uses the GraphQL schema to drive the Neo4j data model and translate GraphQL to Cypher. It integrates really well with the existing GraphQL client and server tools, namely Apollo-client and -server and the just released Apollo Client 2.0 together with Engine and Link.

GRANDstack

We’re happy to announce the launch of GRANDstack (GraphQL, React, Apollo, Neo4j Database) just in time for GraphQL Summit. GRANDstack is a combination of technologies and integrations to enable full-stack development, taking advantage of synergies and symbiotic relationships between technologies in the stack.

Full-stack developers have an amazing choice of technologies available to them and it’s important to move beyond the LAMP and MEAN stacks as technologies have evolved. GRANDstack is our take on how to realize developer productivity and performance from modern tools.

GRANDstack builds on integrations between technologies, such as neo4j-graphql-js, providing a prescriptive and opinionated combination of technologies and integrations for building full-stack applications. Our approach of combining the power of the graph-based data model of Neo4j with the expressiveness of the GraphQL schema and queries was well received at GraphQL Summit.

By inspecting the GraphQL query and schema we’re able to generate a single Cypher query that efficiently retrieves the requested data from Neo4j. We can also generate query types and mutations for the types in your schema.

This means less boilerplate code for GraphQL resolvers for fields, query types and mutations. Incidentally it also saves you from updating all those resolver queries when refactoring your schema. Running just one query against your backend database doesn’t suffer from the n+1 query issue that usually arises from sending one query per field resolver.

To add the power of Cypher to your application, you can either annotate fields, mutations or query types with @cypher directives, e.g., to return recommendations, tree summaries or shortest paths as computed information, or to just handle common cases for querying and updating through Cypher.

Neo4j-GraphQL Apollo Launchpad Challenge

You can see an example of in this Apollo Launchpad that shows a GraphQL server providing an endpoint for a simple Movie Graph. To try it out, you just fork the launchpad and spin up a Neo4j Recommendations Sandbox and add the credentials as secrets.

This gives you not just a running GRANDstack backend but we’ll also send you a T-shirt and sticker if get your forked Launchpad working with Neo4j. Just tweet out the URL for your working Launchpad with #GRANDstack and #Neo4j to claim your t-shirt and sticker.

Level up your graph database game: Click below to register for our online training class, Introduction to Graph Databases and master the world of graph technology in no time.

Author

Michael Hunger & William Lyon, Developer Relations

Michael Hunger has been passionate about software development for a very long time. For the last few years he has been working with Neo Technology on the open source Neo4j graph database filling many roles. As caretaker of the Neo4j community and ecosystem he especially loves to work with graph-related ... know more