Git Product home page Git Product logo

neo4j-graphql-cli's Introduction

Neo4j GraphQL CLI

Deploy Neo4j backed GraphQL APIs based on your custom GraphQL schema.

This is a very early project, under active development. Use for prototyping and demo projects only

What does it do?

neo4j-graphql-cli allows you to deploy a Neo4j GraphQL instance on Neo4j Sandbox. This Neo4j GraphQL instance will serve a GraphQL endpoint based on a user-defined GraphQL schema.

Steps

  1. npm install -g neo4j-graphql-cli
  2. Define your GraphQL schema using GraphQL schema syntax, myschema.graphql
  3. neo4j-graphql myschema.graphql - if you do not specify a schema a default movies schema will be used.
  4. When prompted sign into Neo4j Sandbox using the URL provided. This URL will include a token to associate your neo4j-graphql-cli session with your sandbox instance.
  5. Once your Neo4j GraphQL instance is deployed, you'll be presented with the credentials for your GraphQL instance, including a Graphiql URL.

Schema First Development

IDL / Schema Syntax

Neo4j GraphQL Schema

Neo4j GraphQL supports the basic schema syntax, with the addition of directives that expose the power of a graph database when combined with GraphQL:

  • @cypher

@cypher directive

The @cypher directive exposes the power of a full graph query language, Cypher, through GraphQL.

Example movies schema

type User {
  id: Int
  name: String!
  movies: [Movie] @relation(name: "RATED", direction: "out")
}

type Movie {
  id: Int
  title: String!
  year: Int
  plot: String
  poster: String
  imdbRating: Float
  genres: [Genre] @relation(name: "IN_GENRE", direction: "out")
  actors: [Actor] @relation(name: "ACTED_IN", direction: "in")
  directors: [Director] @relation(name: "DIRECTED", direction: "in")
  similar: [Movie] @cypher(statement: "WITH {this} AS this MATCH (this)-[:IN_GENRE]->(:Genre)<-[:IN_GENRE]-(rec:Movie) WITH rec, COUNT(*) AS num ORDER BY num DESC RETURN rec LIMIT 10")
}

type Genre {
  id: Int
  name: String!
  movies: [Movie] @relation(name: "IN_GENRE", direction: "in")
}

type Director {
  id: Int
  name: String!
  movies: [Movie] @relation(name: "DIRECTED", direction: "out")
}

type Actor {
  id: Int
  name: String!
  movies: [Movie] @relation(name: "ACTED_IN", direction: "out")
}

.graphqlconfig

neo4j-graphql-cli supports .graphqlconfig and will create a .graphqlconfig file that contains the path to the schema file, endpoints and authorization header. For example:

{
  "schemaPath":"personSchema.graphql",
  "extensions":
    {
      "endpoints":
      {
        "dev":
          {
            "url": "10-0-1-70-34285.neo4jsandbox.com/graphql/",
            "headers":
            {
              "Authorization":"Basic ${env:NEO4J_GRAPHQL_TOKEN}"
            }
          }
      }
    }
}

Features

  • deploy Neo4j GraphQL Sandbox instance
  • support user defined GraphQL schema
  • support @cypher GraphQL schema directives
  • .graphqlconfig support
  • support self-hosted Neo4j instances. NOTE: see
  • Docker support
  • support schema updates
  • client app scaffolding

Feedback

This project is in active development and user validation. Have a use case you'd like to see supported? We'd love to hear your feedback, please email [email protected]

neo4j-graphql-cli's People

Contributors

jexp avatar johnymontana avatar mneedham avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.