Build high-performance easily-extensible GraphQL schemas by combining plugins.
NOTE: if you're looking for a performant GraphQL API based on a PostgreSQL database you're probably looking for PostGraphile (previously 'PostGraphQL'); the schema building tools in this repository are used to power PostGraphile among other things.
This repository is a monorepo (managed by lerna):
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.)
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)
This system was originally built by Benjie over a couple of weeks as a proof of concept, growing out of a need for more efficient SQL queries, easier extensibility and greater customisation in PostGraphQL. Over the next year thanks to the input of the community and ongoing development and testing it matured into the production-ready system it is today. 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.
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.
Working with Docker
If you want to work in a Docker environment you can follow the instructions on the wiki.
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
To solve this, we need to re-bootstrap:
rm -Rf packages/*/node_modules yarn lerna bootstrap