Graphile Engine

A library for constructing
high-performance pluggable GraphQL APIs


Graphile Engine for pluggable GraphQL APIs

Using Graphile Engine's plugin architecture you can rapidly generate high-performance extensible GraphQL schemas by combining plugins and leveraging advanced look-ahead features.

Build your schema with plugins
buildSchema(plugins);
type Person {
  # @deprecated Use 'name' instead  # The person's first name
  firstName: String

  #...
Transform your schema with ease
buildSchema([...plugins, DeprecateFromCommentPlugin]);
type Person {
  # The person's first name
  firstName: String @deprecated(    reason: "Use 'name' instead")
  #...

Graphile Engine for GraphQL performance

Say Goodbye to the N+1 problem; fewer round-trips means higher performance.

By using our look-ahead feature your code can know what's coming and make sure it requests the correct fields ahead of time, leading to fewer round-trips and higher performance.

PostGraphile uses this functionality to serve even deeply nested requests with just one SQL query. Result: significantly reduced query latency and massive performance increase.

Automatically build GraphQL objects and fields through database introspection

The core graphile-build library treats GraphQL as a first-class target, and out of the box does not discriminate between your datastore. By using plugins to introspect your datastore you can automatically build your GraphQL objects and eliminate the development work required to keep your codebase and database schema in sync.

graphile-build-pg is a collection of plugins which adds extensive support for the popular PostgreSQL database system by performing introspection of your database schema and automatically building the relevant GraphQL objects and fields based on the tables, columns, functions, relations that it finds. This is the core of PostGraphile.

You can build plugins for anything that Node.js can communicate with.

Straightforward integration

If you're already building with the reference implementation of GraphQL from Facebook then adding hooks is fairly straightforward:

graphql
const MyType =
  new GraphQLObjectType({    name: 'MyType',
    fields: {
      // ...
graphile-build
const MyType =
  newWithHooks(GraphQLObjectType, {    name: 'MyType',
    fields: {
      // ...

Fully GraphQL compatible

Graphile uses the reference GraphQL implementation under the hood, so you know it's spec compliant.

This also means you can mix it into existing GraphQL APIs, or mix existing GraphQL object types into it (so long as they use the reference GraphQL implementation too).

Automatically update your running GraphQL schema without the need to restart

For example: when your underlying data structure changes your Graphile Engine plugins can trigger a rebuild event and you'll automatically be supplied with a fresh new GraphQL schema to replace the out-of-date one - no need to restart your server!

Quick to start

const { buildSchema, defaultPlugins } = require("graphile-build");
const { printSchema } = require("graphql/utilities");

async function main() {
  const schema = await buildSchema(defaultPlugins);
  console.log(printSchema(schema));
}

main();

Questions, comments or feedback?
Email [email protected]

Keep up to date on Graphile and PostGraphile features/changes. Subscribe to our occasional announcements newsletter: