A lightweight HTTP client for GraphQL APIs built on the fetch API with isomorphic-fetch for cross-environment support. Current stable version is 2.0.1, with no recent release activity (last updated years ago). It provides a simple promise-based interface for executing queries and mutations, with built-in error handling that includes query location highlighting. Simpler than Apollo or Relay, but lacks subscriptions, caching, and active maintenance. Suitable for minimal integrations in Node.js or browsers where a full-fledged client is overkill.
npm install graphql-clientNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates creating a client with URL and headers, then executing a query with variables.
Replace isomorphic-fetch with cross-fetch or remove polyfill if using Node 18+.
Always attach a .catch() handler or use async/await with try/catch.
Destructure { query, mutate } from the factory call.Consider using a maintained alternative like graphql-request or Apollo Client.
Use 'import client from 'graphql-client'' or 'const client = require('graphql-client')'.Add .catch(err => console.error(err.message)) or wrap in try/catch.
Install isomorphic-fetch or cross-fetch and import it before graphql-client.