An alternative GraphQL execution engine for JavaScript that plans and optimizes queries before execution. Version 1.0.2, actively developed with regular releases on npm. Unlike GraphQL.js's default execute, Gra*fast* analyzes the full request upfront, creates an operation plan (detailing abstract steps), optimizes it (removing duplicates, merging steps), and then executes. This leads to significant performance gains, especially for complex queries. It supports both traditional resolvers and new 'plan resolvers' for deeper integration. Requires Node >=22, GraphQL.js v16+, and @envelop/core v5+. Ships TypeScript types. Backward compatible with most existing GraphQL.js schemas.
npm install grafastNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows minimal usage: building a GraphQL.js schema, parsing a query, and executing with grafast as a drop-in replacement for GraphQL.js execute.
Ensure contextValue is an object (not null, not a primitive).
Do not replace the default field resolver; Gra*fast* relies on it.
Upgrade Node.js to version 22 or later.
Install @envelop/core@^5.0.0 alongside grafast.
Use import statements or dynamic import() instead of require().
Provide a plain object or class instance as contextValue.
Run npm install @envelop/core@^5.0.0.