Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including graphene-js with all npm packages installed. Try it out:

var grapheneJs = require("graphene-js")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

graphene-js v0.5.2

GraphQL Framework for Javascript

Graphene-JS Build Status PyPI version Coverage Status

Graphene-JS is a JS framework for building GraphQL schemas/types fast and easily.

  • Easy to use: Graphene helps you use GraphQL in Javascript without effort.
  • Relay: Graphene has builtin support for Relay. (on the works)
  • Data agnostic: Graphene supports any kind of data source: SQL (Sequelize), NoSQL, custom objects, etc. We believe that by providing a complete API you could plug Graphene-JS anywhere your data lives and make your data available through GraphQL.

Check also the architecture docs to see how Graphene-JS is architected to ease the development of GraphQL in JS.

Integrations

Graphene has multiple integrations with different frameworks:

integrationPackage
Sequelizegraphene-sequelize
TypeORMon the works

Also, Graphene is fully compatible with the GraphQL spec, working seamlessly with all GraphQL clients, such as Relay, Apollo and urql.

Installation

For instaling graphene, just run this command in your shell

npm install --save graphene-js
# or
yarn add graphene-js

Examples

Here is one example for you to get started:

import { ObjectType, Field, Schema } from "graphene-js";

@ObjectType()
class Query {
  @Field(String)
  hello() {
    return "Hello world!";
  }
}

const schema = new Schema({ query: Query });

Then Querying graphene.Schema is as simple as:

query = `
    query SayHello {
      hello
    }
`;

var result = schema.execute(query);

If you want to learn more, you can also check the documentation or check the provided examples:

Contributing

After cloning this repo, ensure dependencies are installed by running:

yarn

After developing, the full test suite can be evaluated by running:

yarn test

You can also get the coverage with:

yarn test --coverage

Documentation

The documentation is generated using the excellent Sphinx and a custom theme.

The documentation dependencies are installed by running:

cd docs
pip install -r requirements.txt

Then to produce a HTML version of the documentation:

make html
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free