Putting the Graph into GraphQL

Neo4j GraphQL Library

An extensible, low-code, open source library designed for building API-driven, intelligent applications faster with a Neo4j graph database.

Build Intelligent, Modern APIs with Ease

The Neo4j GraphQL Library is a highly flexible, low-code, open source JavaScript library that enables rapid API development for cross-platform and mobile applications by tapping into the power of connected data.

With Neo4j as the graph database, the GraphQL Library makes it simple for applications to have application data treated as a graph natively from the front-end all the way to storage, avoiding duplicate schema work and ensuring flawless integration between front-end and backend developers.

Written in TypeScript, the library's schema-first paradigm lets developers focus on the application data they need, while taking care of the heavy lifting involved in building the API.

Benefits of the Neo4j GraphQL Library

Powerful and fast

Low-Code and High Performance

Don't yet understand Cypher? Don't sweat it. The library translates GraphQL queries into a single Cypher query. Developers using this library can focus solely on building applications while just writing minimal backend code – the library handles the rest.

Secure, reliable, and data-rich

Modern and Intelligent

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.

Built for developer flexibility


Enabling full-stack developers with GraphQL-first development, the library generates Cypher from GraphQL, GraphQL CRUD API from type definitions, auto-generated resolvers, and custom logic with @cypher schema directive. Also comes with powerful authorization to secure your GraphQL API, nested mutations, and an OGM (Object-Graph-Mapper).

Choose your platform

Open and Flexible

Fast, open, and fun for developers, 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 the Neo4j GraphQL Library Works

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.

Neo4j GraphQL Library Features

Generate GraphQL CRUD API

Neo4j GraphQL Library automatically creates Query and Mutation types from your type definitions that provide instant CRUD functionality. The GraphQL CRUD API can be configured and extended, and helps define the database schema and the GraphQL schema with the same type definitions.

type Movie {
title: String!
actors: [Person] @relationship(type: "ACTED_IN", direction: IN)
type Person {
  name: String
  movies(where: { title_CONTAINS: "River Runs Through It" }) {
    actors {
    genres {
    directors {
      directed {
MATCH (a:Actor)-[:ACTED_IN]->(m:Movie)-[:IN_GENRE]->(g:Genre)
WHERE m.title CONTAINS "River Runs Through It"
MATCH (m)<-[:DIRECTED]-(d:Director)-[:DIRECTED]->(o:Movie)

Generate Cypher from GraphQL

The Neo4j GraphQL Library generates a single Cypher query to resolve any arbitrary GraphQL request.

This means the resolvers are automatically implemented for your scenario. No need to write boilerplate data fetching code – just inject a Neo4j driver instance into the request context and Neo4j GraphQL Library takes care of generating the database query and handling the database call. Additionally, since a single Cypher query is generated, this results in a huge performance boost and eliminates the N+1 query problem.

Extending GraphQL with Cypher

Since GraphQL is an API query language and not a database query language, it lacks semantics for operations such as aggregations, projections, and more complex graph traversals.

You can now extend the power of GraphQL through the use of @cypher GraphQL schema directives to bind the results of a Cypher query to a GraphQL field. This allows for the expression of complex logic using Cypher and can be used on Query and Mutation fields to define custom data fetching or mutation logic.

The Neo4j native graph database makes complex and multi-hop graph traversals highly performant to provide blazing-fast query response for your applications.

type Movie {
title: String!
actors: [Person] @relationship(type: "ACTED_IN", direction: IN)
similar(first: Int = 3): [Movie]
    statement: """
    MATCH (this)<-[:ACTED_IN|:DIRECTED]-(o)-[:ACTED_IN|:DIRECTED]->(rec:Movie)
    WITH rec, COUNT(*) AS score
    RETURN rec ORDER BY score DESC LIMIT $first
type Person {
name: String
type Movie {
  title: String!
  actors: [Person] @relationship(type: "ACTED_IN", direction: IN)
  directors: [Person] @relationship(type: "DIRECTED", direction: IN)
type Person {
  name: String
extend type Movie
  rules: [{ operations: [UPDATE], allow: { directors: { id: "$jwt.sub" } } }]

Secure APIs with In-Built Auth

Neo4j GraphQL Library comes with an Auth directive out-of-the-box for enabling authorization rules to GraphQL API using JSON Web Tokens (JWTs).

Having lots of different approaches to securing GraphQL API puts some beginners off. With the Auth directive, we have reduced a lot of complexity that comes with building a secure GraphQL API. Including Auth provides a working solution to users wanting to quickly and easily "spin up" secure services. Also, the power of Cypher effectively enables the library to translate complex authorization rules into a single Cypher query.

Power REST APIs and More with OGM

If you don't know what OGM (Object Graph Mapper) is, no worries. It's an ORM (Object Relational Mapper) for your graph database and provides a type-safe wrapper around the CRUD API. You can use the OGM, just as you would ORM, to power REST APIs, custom scripts, migrations, authentication, and anywhere you interact with Neo4j.

When using the Neo4j GraphQL Library, there may be a time when you need to define a custom query or mutation – you can use the OGM here. This means, you don't need to write a custom Cypher in your application. Cool, right?!

const { OGM } = require("@neo4j/graphql-ogm");
const neo4j = require("neo4j-driver");
const typeDefs = `
type Movie {
  title: String!
  actors: [Person] @relationship(type: "ACTED_IN", direction: IN)
type Person {
  name: String
const driver = neo4j.driver(
neo4j.auth.basic("admin", "password")
const ogm = new OGM({
const Movie = ogm.model("Movie");
input: [
    title: "Forrest Gump",
    actors: {
      create: [{ name: "Tom Hanks" }],
}).then(() => console.log("Movie Created"));

See What Our Users Are Saying

  • TypeScript + @neo4j + @neo4j/graphql + Apollo + AWS Lambda + Pulumi makes for an awesome API prototyping stack, and gives you tons of power up front so you don’t have to write as much cypher."

    Noël Jackson, Developer,
  • “I am absolutely blown away how easy it is to spin up a GraphQL API on top of my Neo4j database. Incorporating user authentication was a breeze; freeing me up to explore user roles and permissions. The authentication/authorization is straightforward and easy to grok. So easy a drummer can do it!”

    Rob Brennan, Consulting Architect, GenUI
  • "I'm so excited! I have the feeling all my requirements are taken into account by the new API. I really, really love the new library and the efforts that Neo4j is taking to provide better integration of the database into the application layer, especially for a GraphQL API."

    Robert Schäfer, Full-Stack Engineer
  • “Spent the weekend and a couple days this week and completely refactored our app to use alpha. I ditched SO MUCH code with the new auth and “connect” functionality. Thanks guys!”

    Thomas Lester, Founder / Developer
  • "You have all done such a great job addressing the exact pain points we've been experiencing. thank you!”

    Oren Goldberg, Lead Engineer at United for Respect
  • “Hi there! Just discovered this new alpha release. It looks super nice, and seems to solve a lot of the small issues we have faced in the current js library! Great work Do you have any release plan / ETA for when this would be released in a stable version? Would love to start migrating as soon as possible”

    Neo4j GraphQL Library User

Featured Content


GraphQL Library Product Brief


Announcing the Neo4j GraphQL Library: Build Low-Code GraphQL APIs Faster


Announcing the Stable Release of the Official Neo4j GraphQL Library 1.0.0


Try GraphQL with Recommendations Dataset


Building GraphQL APIs Using The Neo4j GraphQL Library


The Neo4j GraphQL Library

Ready to Get Started?

Ready to dig deeper into the Neo4j GraphQL Library? Sign up for our GraphAcademy course Building GraphQL APIs Using the Neo4j GraphQL Library and get started today!

Learn More