All Projects → neo4j-graphql → Neo4j Graphql Js

neo4j-graphql / Neo4j Graphql Js

Licence: other
A GraphQL to Cypher query execution layer for Neo4j and JavaScript GraphQL implementations.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Neo4j Graphql Js

neo4j-graphql-java
Pure JVM translation for GraphQL queries and mutations to Neo4j's Cypher
Stars: ✭ 94 (-83.93%)
Mutual labels:  neo4j, cypher
legis-graph
ETL scripts for loading US Congressional data from govtrack.us into Neo4j
Stars: ✭ 48 (-91.79%)
Mutual labels:  neo4j, cypher
NeoClient
🦉 Lightweight OGM for Neo4j which support transactions and BOLT protocol.
Stars: ✭ 21 (-96.41%)
Mutual labels:  neo4j, cypher
Public-Transport-SP-Graph-Database
Metropolitan Transport Network from São Paulo mapped in a NoSQL graph database.
Stars: ✭ 25 (-95.73%)
Mutual labels:  neo4j, cypher
Neode
Neo4j OGM for Node.js
Stars: ✭ 276 (-52.82%)
Mutual labels:  cypher, neo4j
ml-models
Machine Learning Procedures and Functions for Neo4j
Stars: ✭ 63 (-89.23%)
Mutual labels:  neo4j, cypher
neo4j-ml-procedures
This project provides procedures and functions to support machine learning applications with Neo4j.
Stars: ✭ 37 (-93.68%)
Mutual labels:  neo4j, cypher
Human Connection
Free and open-source social network for active citizenship.
Stars: ✭ 177 (-69.74%)
Mutual labels:  graphql, neo4j
gogm
Golang Object Graph Mapper for Neo4j
Stars: ✭ 71 (-87.86%)
Mutual labels:  neo4j, cypher
neo4rs
Neo4j driver for rust
Stars: ✭ 41 (-92.99%)
Mutual labels:  neo4j, cypher
OGMNeo
[No Maintenance] Neo4j nodeJS OGM(object-graph mapping) abstraction layer
Stars: ✭ 54 (-90.77%)
Mutual labels:  neo4j, cypher
Grand Stack Starter
Simple starter project for GRANDstack full stack apps
Stars: ✭ 419 (-28.38%)
Mutual labels:  graphql, neo4j
angular-neo4j
Neo4j Bolt driver wrapper for Angular
Stars: ✭ 18 (-96.92%)
Mutual labels:  neo4j, cypher
decypher
A handful of cypher utilities for Node.js
Stars: ✭ 34 (-94.19%)
Mutual labels:  neo4j, cypher
neo4j-faker
Use faker cypher functions to generate demo and test data with cypher
Stars: ✭ 30 (-94.87%)
Mutual labels:  neo4j, cypher
Graph-OLAP
An attempt to model an OLAP cube with Neo4j.
Stars: ✭ 37 (-93.68%)
Mutual labels:  neo4j, cypher
Movies Python Bolt
Neo4j Movies Example application with Flask backend using the neo4j-python-driver
Stars: ✭ 197 (-66.32%)
Mutual labels:  cypher, neo4j
Neo4j Graphql
An optimized neo4j query resolver for Facebook's GraphQL
Stars: ✭ 60 (-89.74%)
Mutual labels:  graphql, neo4j
seabolt
Neo4j Bolt Connector for C
Stars: ✭ 37 (-93.68%)
Mutual labels:  neo4j, cypher
Popoto
Visual query builder for Neo4j graph database
Stars: ✭ 318 (-45.64%)
Mutual labels:  cypher, neo4j

CI status codecov npm version Docs link

neo4j-graphql.js

A GraphQL to Cypher query execution layer for Neo4j and JavaScript GraphQL implementations.

NOTE: neo4j-graphql.js is facilitated by Neo4j Labs. Work has begun on an official Neo4j GraphQL library (@neo4j/graphql), which is currently available as an alpha release on npm. You can find more information and documentation for the @neo4j/graphql library here.

Installation and usage

Install

npm install --save neo4j-graphql-js

Usage

Start with GraphQL type definitions:

const typeDefs = `
type Movie {
    title: String
    year: Int
    imdbRating: Float
    genres: [Genre] @relation(name: "IN_GENRE", direction: "OUT")
}
type Genre {
    name: String
    movies: [Movie] @relation(name: "IN_GENRE", direction: "IN")
}
`;

Create an executable schema with auto-generated resolvers for Query and Mutation types, ordering, pagination, and support for computed fields defined using the @cypher GraphQL schema directive:

import { makeAugmentedSchema } from 'neo4j-graphql-js';

const schema = makeAugmentedSchema({ typeDefs });

Create a neo4j-javascript-driver instance:

import { v1 as neo4j } from 'neo4j-driver';

const driver = neo4j.driver(
  'bolt://localhost:7687',
  neo4j.auth.basic('neo4j', 'letmein')
);

Use your favorite JavaScript GraphQL server implementation to serve your GraphQL schema, injecting the Neo4j driver instance into the context so your data can be resolved in Neo4j:

import { ApolloServer } from 'apollo-server';

const server = new ApolloServer({ schema, context: { driver } });

server.listen(3003, '0.0.0.0').then(({ url }) => {
  console.log(`GraphQL API ready at ${url}`);
});

If you don't want auto-generated resolvers, you can also call neo4jgraphql() in your GraphQL resolver. Your GraphQL query will be translated to Cypher and the query passed to Neo4j.

import { neo4jgraphql } from 'neo4j-graphql-js';

const resolvers = {
  Query: {
    Movie(object, params, ctx, resolveInfo) {
      return neo4jgraphql(object, params, ctx, resolveInfo);
    }
  }
};

What is neo4j-graphql.js

A package to make it easier to use GraphQL and Neo4j together. neo4j-graphql.js translates GraphQL queries to a single Cypher query, eliminating the need to write queries in GraphQL resolvers and for batching queries. It also exposes the Cypher query language through GraphQL via the @cypher schema directive.

Goals

  • Translate GraphQL queries to Cypher to simplify the process of writing GraphQL resolvers
  • Allow for custom logic by overriding of any resolver function
  • Work with graphql-tools, graphql-js, and apollo-server
  • Support GraphQL servers that need to resolve data from multiple data services/databases
  • Expose the power of Cypher through GraphQL via the @cypher directive

Benefits

  • Send a single query to the database
  • No need to write queries for each resolver
  • Exposes the power of the Cypher query language through GraphQL

Contributing

See our detailed contribution guidelines.

Examples

See /examples

Documentation

Full docs can be found on GRANDstack.io/docs

Debugging and Tuning

You can log out the generated cypher statements with an environment variable:

DEBUG=neo4j-graphql-js node yourcode.js

This helps to debug and optimize your database statements. E.g. visit your Neo4J browser console at http://localhost:7474/browser/ and paste the following:

:params :params { offset: 0, first: 12, filter: {}, cypherParams: { currentUserId: '42' } }

and now profile the generated query:

EXPLAIN MATCH (`post`:`Post`) WITH `post` ORDER BY post.createdAt DESC RETURN `post` { .id , .title } AS `post`

You can learn more by typing:

:help EXPLAIN
:help params
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].