Gatsby Source Graphql Universal

screenshot of Gatsby Source Graphql Universal

Plugin for connecting arbitrary GraphQL APIs to Gatsby GraphQL with client side execution

Overview

Gatsby-source-graphql-universal offers a powerful enhancement to the existing gatsby-source-graphql plugin, providing developers with the capability to utilize GraphQL queries in a more flexible manner. This version aims to streamline the development process by allowing queries to be reused and manipulated directly within the browser environment. Ideal for those who seek to integrate remote GraphQL APIs seamlessly into their Gatsby projects, this plugin introduces innovative ways to handle data fetching and component composition.

As a higher-order component, it enables more comprehensive access to fetched data, ensuring developers can easily manage and leverage GraphQL queries without the constraints that typically accompany static query definitions. With robust features and the ability to customize query handling, gatsby-source-graphql-universal is perfect for projects requiring dynamic data integrations.

Features

  • Higher-Order Component: Wrap components to access GraphQL queries in the browser effortlessly.
  • Data Prop Overwrite: Allows the data prop to be overwritten with new data when the composeData prop is set to true, enhancing data management.
  • Isolated Query Retrieval: Easily access original GraphQL query sources for further manipulation, promoting flexibility in data usage.
  • Comprehensive Query Configuration: Supports various options like fragments and composeData to tailor queries to specific needs.
  • Environment Variable Support: Uses dotenv to handle environment variables securely during the build process, preventing sensitive data from being exposed.
  • Custom Schema Definitions: Offers the ability to construct schema definitions using the createSchema callback, allowing for more control over schema consumption.
  • Periodic Data Refetching: Configurable refetching options enable developers to keep data fresh without needing to restart the server, thanks to the refetchInterval setting.