Graphqurl is a curl like CLI for GraphQL. Its features include:
- CLI for making GraphQL queries. It also provisions queries with autocomplete.
- Run a custom GraphiQL, where you can specify request's headers, locally against any endpoint.
- Can be used as a library with Node.js or from the browser.
- Supports subscriptions over websocket.
- Can export GraphQL schema(s).
Graphqurl, until v0.3.3, used Apollo client under the hood for making GraphQL queries and subscriptions. This caused the bundle size to explode considerably (142kB).
With v1.0, Graphqurl uses light-weight isomorphic HTTP clients which reduced the bundle size by over 80kB, i.e by a whopping 56%. It is now an ideal tool for use cases where users wish to make GraphQL queries, mutations and subscriptions without any extra overhead of caching and networking. This is what the new bundle composition looks like:
Note that the size of the CLI binary is not considered in the above bundle size distribution. That said, the CLI binary in v1.0.1 has also been optimised and is about 300kB lighter than that of v0.3.3.
You can run a custom Graphiql in graphqurl. In v1.0 we have extended it to include popular community tools like:
You can also run graphiql on host and port of your choice by using the
--graphiqlPort flags on the CLI.
The parsing of GraphQL queries before execution, has been removed because it is unnecessary for a scripting tool like graphqurl, as most users build GraphQL queries through auto-completion tools like GraphiQL, which highly reduce the possibility of syntax errors. This means, the syntax errors in your GraphQL queries, if any, shall not be caught before the query actually hits the GraphQL server.
If you've been using graphqurl in node scripts and in the browser, the API has changed considerably. The usage of graphqurl as a node library v1.0 onwards involves creating a client followed by executing GraphQL operations, whereas until v0.3.3, you could import a
query function and execute it.
The complete changelog can be found here for complete list of changes in the latest release.
Moving forward, we have the following things on the roadmap:
- TypeScript support
- Allow refreshing websocket connection if auth session expires
- Allow subscribing to a GraphQL query through polling