Plugins are the hearth of Envelop. Without adding any plugins, the GraphQL execution layer provided by Envelop does not differ from the core GraphQL execution layer provided by GraphQL.js.
Envelop plugins are based on a simple event-based contract that allows extending and overwriting the
GraphQL execution logic, by wrapping the functions
Generic logic can be shared as a plugin, that can be distributed via npm.
Plugins are capable of modifying and altering every aspect of the GraphQL execution flow, allowing
you to hook into the phases before and after
subscribe, as well as
building your GraphQL context.
Plugins can also change the GraphQL schema during execution - so if your server has a schema that could change dynamically, you can constantly update it. Plugins can listen to schema changes and run logic accordingly.
You can find a list of all plugins, their documentation and installation instructions on the Envelop Plugin Hub.
The plugin order specifies the order in which the handlers of each plugin will be invoked. E.g. the
onExecute hook of the plugin at the array index 0 will always be invoked before the plugin at the
Plugins have the option to stop the execution completly and stop calling further plugins
useResponseCache plugin is such a plugin. Once a response is served from the cache all
onExecute are never called and all
onExecuteDone hooks are never called at all.