Coder Social home page Coder Social logo

newswim / graphile-build Goto Github PK

View Code? Open in Web Editor NEW

This project forked from graphile/graphile-engine

0.0 2.0 0.0 809 KB

Build a high-performance easily-extensible GraphQL schema by combining plugins

Home Page: https://www.graphile.org/

JavaScript 95.65% PLpgSQL 4.09% Shell 0.27%

graphile-build's Introduction

GraphQL-Build

Build a high-performance easily-extensible GraphQL schema by combining plugins.

This repository is a monorepo (managed by lerna) which comprises the following packages:

graphile-build: The core package: a simple plugin system that enables you to build a GraphQL schema out of plugins

graphile-build-pg: A selection of plugins related to PostgreSQL: schema introspection, generation of fields and types for all tables, computed columns, query procedures, etc - if there's certain features you don't want, simply don't use that plugin! (Surfacing plugin dependencies has not been built yet, so be careful when you disable a plugin.)

postgraphile-core: Intended to be used by PostGraphQL in order to provide its schema functionality (excluding HTTP handling, etc)

graphql-parse-resolve-info: Parses a GraphQLResolveInfo object into a tree of the fields that are being requested to enable optimisations to your GraphQL schema (e.g. we use it to determine which fields are required from the SQL database)

Status

  • graphile-build - working (but needs tests, more documentation, refactoring, and probably needs to support more hooks)

  • graphile-build-pg / postgraphile-core - working - passes the PostGraphQL integration tests for queries and mutations, no descriptions are added to fields yet

  • graphql-parse-resolve-info - complete (but needs dedicated tests because it's currently only tested by virtue of the postgraphile-core tests depending on it)

Running on Node less than v8

We actually bundle two copies of each module - one compiled for Node v8+ and one for Node v4+. This is accomplished using Babel's env preset. You can see the switching code in, e.g., packages/graphile-build/index.js. This has a couple consequences:

  • We'll run a lot faster on Node v8 because most of the code is passed through verbatim - for example we can use Node v8+'s built in async/await rather than emulating with generators/promises/etc
  • When we're developing we only compile the Node v8+ version so we can minimize latency, so if you wish to contribute keep your Node up to date!

You're highly encouraged to upgrade to Node v8, not just for the fancy new features but also the performance improvements!

History

This system grew out of a need for more efficient SQL queries, easier extensibility and customisation in PostGraphQL. I'm extremely grateful to Caleb Meredith for the stellar work he put into PostGraphQL, and to the community who helped me come up with this idea.

Development

npm install -g lerna yarn
yarn
lerna bootstrap
npm run watch

Watch will keep monitoring and compiling the babel files. Then to run the tests in another terminal:

lerna run test

If the above succeeds, you're good to go! If not, please reach out on twitter: @benjie.

GraphQL conflict

If you get an error like the below:

GraphQL conflict for 'GraphQLObjectType' detected! Multiple versions of graphql exist in your node_modules?

it means the peerDependencies have been installed locally in each package which is not what we want (we want them installed in the root node_modules.

To solve this, we need to re-bootstrap:

rm -Rf packages/*/node_modules
yarn
lerna bootstrap

graphile-build's People

Contributors

0ff avatar benjie 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.