PageSourceSearch

https://build.graphile.org/assets/js/5d42abac.f08ab4af.js

js graphile.org collected 2026-10-02 07:06:10 UTC 9,476 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunk_localrepo_graphile_build_website=globalThis.webpackChunk_localrepo_graphile_build_website||[]).push([[4303],{6919(e,n,a){a.r(n),a.d(n,{assets:()=>o,contentTitle:()=>l,default:()=>c,frontMatter:()=>s,metadata:()=>r,toc:()=>h});const r=JSON.parse('{"id":"index","title":"Overview","description":"Graphile Engine enables you to build high-performance easily-extensible GraphQL schemas by combining plugins.","source":"@site/versioned_docs/version-4/index.md","sourceDirName":".","slug":"/","permalink":"/graphile-build/4/","draft":false,"unlisted":false,"editUrl":"https://github.com/graphile/crystal/tree/main/graphile-build/website/graphile-build/index.md","tags":[],"version":"4","lastUpdatedAt":1774299576000,"frontMatter":{"title":"Overview","hide_table_of_contents":true},"sidebar":"docs","next":{"title":"Getting Started","permalink":"/graphile-build/4/getting-started"}}');var i=a(1085),t=a(1184);const s={title:"Overview",hide_table_of_contents:!0},l=void 0,o={},h=[{value:"Graphile Engine for pluggable GraphQL APIs",id:"graphile-engine-for-pluggable-graphql-apis",level:3},{value:"Build your schema with plugins",id:"build-your-schema-with-plugins",level:4},{value:"Transform your schema with ease",id:"transform-your-schema-with-ease",level:4},{value:"Graphile Engine for GraphQL performance",id:"graphile-engine-for-graphql-performance",level:3},{value:"Automatically build GraphQL objects and fields through database introspection",id:"automatically-build-graphql-objects-and-fields-through-database-introspection",level:3},{value:"Straightforward integration",id:"straightforward-integration",level:3},{value:"<code>graphql</code>",id:"graphql",level:4},{value:"<code>graphile-build</code>",id:"graphile-build",level:4},{value:"Fully GraphQL compatible",id:"fully-graphql-compatible",level:3},{value:"Automatically update your running GraphQL schema without the need to restart",id:"automatically-update-your-running-graphql-schema-without-the-need-to-restart",level:3},{value:"Quick to start",id:"quick-to-start",level:3}];function d(e){const n={a:"a",code:"code",em:"em",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,t.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.p,{children:"Graphile Engine enables you to build high-performance easily-extensible GraphQL schemas by combining plugins."}),"\n",(0,i.jsxs)(n.p,{children:["Proof of concept was built by ",(0,i.jsx)(n.a,{href:"https://benjie.dev",children:"@Benjie"})," in 2017, growing out of a need for greater performance, easier extensibility and greater customisation in what was then known as ",(0,i.jsx)(n.a,{href:"https://postgraphile.org",children:"PostGraphQL"}),". Over the next year thanks to the input of the community and ongoing development and testing, Graphile Engine matured into the production-ready system it is today."]}),"\n",(0,i.jsxs)(n.p,{children:["In versions later than 4.x, Graphile Engine has been rewritten and split into two parts: the ",(0,i.jsx)(n.em,{children:"engine"})," became the basis for ",(0,i.jsxs)(n.a,{href:"https://grafast.org",children:["Gra",(0,i.jsx)(n.em,{children:"fast"})]})," and the remaining project renamed Graphile Build."]}),"\n",(0,i.jsx)(n.h3,{id:"graphile-engine-for-pluggable-graphql-apis",children:"Graphile Engine for pluggable GraphQL APIs"}),"\n",(0,i.jsx)(n.p,{children:"Using Graphile Engine's plugin architecture you can rapidly generate high-performance extensible GraphQL schemas by combining plugins and leveraging advanced look-ahead features."}),"\n",(0,i.jsx)(n.h4,{id:"build-your-schema-with-plugins",children:"Build your schema with plugins"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"buildSchema(plugins);\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-graphql",children:"type Person {\n  /* highlight-next-line */\n  # @deprecated Use 'name' instead\n  # The person's first name\n  firstName: String\n\n  #...\n"})}),"\n",(0,i.jsx)(n.h4,{id:"transform-your-schema-with-ease",children:"Transform your schema with ease"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"buildSchema([...plugins, DeprecateFromCommentPlugin]);\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-graphql",children:"type Person {\n  # The person's first name\n  /* highlight-start */\n  firstName: String @deprecated(\n    reason: \"Use 'name' instead\")\n  /* highlight-end */\n\n  #...\n"})}),"\n",(0,i.jsx)(n.h3,{id:"graphile-engine-for-graphql-performance",children:"Graphile Engine for GraphQL performance"}),"\n",(0,i.jsx)(n.p,{children:"Say Goodbye to the N+1 problem; fewer round-trips means higher performance."}),"\n",(0,i.jsxs)(n.p,{children:["By using our ",(0,i.jsx)(n.a,{href:"/graphile-build/4/look-ahead",children:"look-ahead feature"}
1)," your code can\nknow what's coming and make sure it requests the correct fields ahead of time,\nleading to fewer round-trips and higher performance."]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.a,{href:"https://postgraphile.org",children:"PostGraphile 4.0"})," uses this functionality to serve even deeply\nnested requests with just one SQL query. Result: significantly reduced query\nlatency and massive performance increase."]}),"\n",(0,i.jsx)(n.h3,{id:"automatically-build-graphql-objects-and-fields-through-database-introspection",children:"Automatically build GraphQL objects and fields through database introspection"}),"\n",(0,i.jsxs)(n.p,{children:["The core ",(0,i.jsx)(n.code,{children:"graphile-build"})," library treats GraphQL as a first-class target, and\nout of the box does not discriminate between your datastore. By using plugins to\nintrospect your datastore you can automatically build your GraphQL objects and\neliminate the development work required to keep your codebase and database\nschema in sync."]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.a,{href:"/graphile-build-pg/4",children:(0,i.jsx)(n.code,{children:"graphile-build-pg"})})," is a collection of plugins which adds extensive support for\nthe popular PostgreSQL database system by performing introspection of your\ndatabase schema and ",(0,i.jsx)(n.strong,{children:"automatically"})," building the relevant GraphQL objects and\nfields based on the tables, columns, functions, relations that it finds. This is\nthe core of ",(0,i.jsx)(n.a,{href:"https://postgraphile.org",children:"PostGraphile 4.0"}),"."]}),"\n",(0,i.jsx)(n.p,{children:"You can build plugins for anything that Node.js can communicate with."}),"\n",(0,i.jsx)(n.h3,{id:"straightforward-integration",children:"Straightforward integration"}),"\n",(0,i.jsx)(n.p,{children:"If you're already building with the reference implementation of GraphQL from\nFacebook then adding hooks is fairly straightforward:"}),"\n",(0,i.jsx)(n.h4,{id:"graphql",children:(0,i.jsx)(n.code,{children:"graphql"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"const MyType =\n/* highlight-next-line */\n  new GraphQLObjectType({\n    name: 'MyType',\n    fields: {\n      // ...\n"})}),"\n",(0,i.jsx)(n.h4,{id:"graphile-build",children:(0,i.jsx)(n.code,{children:"graphile-build"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"const MyType =\n/* highlight-next-line */\n  newWithHooks(GraphQLObjectType, {\n    name: 'MyType',\n    fields: {\n      // ...\n"})}),"\n",(0,i.jsx)(n.h3,{id:"fully-graphql-compatible",children:"Fully GraphQL compatible"}),"\n",(0,i.jsxs)(n.p,{children:["Graphile Engine uses the ",(0,i.jsx)("a",{href:"http://graphql.org/graphql-js/",children:"reference GraphQL\nimplementation"})," under the hood, so you know it's spec compliant."]}),"\n",(0,i.jsx)(n.p,{children:"This also means you can mix it into existing GraphQL APIs, or mix existing\nGraphQL object types into it (so long as they use the reference GraphQL\nimplementation too)."}),"\n",(0,i.jsx)(n.h3,{id:"automatically-update-your-running-graphql-schema-without-the-need-to-restart",children:"Automatically update your running GraphQL schema without the need to restart"}),"\n",(0,i.jsxs)(n.p,{children:["For example: when your underlying data structure changes your Graphile Build\nplugins can ",(0,i.jsx)(n.a,{href:"./schema-builder#registerwatcherwatcher-unwatcher",children:"trigger a rebuild"})," event and you'll automatically be supplied with a\nfresh new GraphQL schema to replace the out-of-date one - no need to restart\nyour server!"]}),"\n",(0,i.jsx)(n.h3,{id:"quick-to-start",children:"Quick to start"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:'import { buildSchema, defaultPreset } from "graphile-build";\nimport { printSchema } from "graphql";\n\nconst preset = {\n  extends: [\n    defaultPreset,\n    // Add more presets here!\n  ],\n};\n\nconst schema = await buildSchema(preset);\nconsole.log(printSchema(schema));\n'})})]})}function c(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},1184(e,n,a){a.d(n,{R:()=>s,x:()=>l});var r=a(4041);const i={},t=r.createContext(i);function s(e){const n=r.useContext(t);return r.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:s(e.components),r.createElement(t.Provider,{value:n},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.