Future
To view this content, buy the book! 😃🙏
Or if you’ve already purchased.
Future
The largest change to GraphQL-land in the coming years will be its size! The S curve of GraphQL adoption is currently in the exponential phase (seemingly exponential—technically, it’s logistic). Here’s a graph of the graphql
package’s weekly npm downloads over the first 5 years:
And it doesn’t even include client packages like apollo-client
, which are also growing. At the time of writing, apollo-client
has over 1M weekly downloads. There’s also a lot of room left to grow—according to Google Trends, REST still has 3x the interest that GraphQL has:
As adoption grows, more resources will be put into GraphQL libraries, tools, and services. The existing ones will improve, and new ones will be created.
- Apollo Server’s roadmap lists near-term future work, including:
- Adding subscription support to Apollo Federation.
- Adding
@defer
and@stream
directives. - Invalidation of whole-query cache through cache tags with CDN integration.
- Building a “graph” caching layer for the gateway.
- Apollo Client also has a roadmap as well.
- For some futuristic-seeming services and tooling, check out this video from the creator of OneGraph (a GraphQL API we use in the Stripe and Service Integrations chapter that combines many different companies’ APIs).
- An exciting area in which we’re looking forward to growth is full-stack GraphQL frameworks—the Ruby on Rails of GraphQL, Node, and React. Our current favorite is RedwoodJS, a new project based on Apollo, serverless, and Prisma.
There will also be changes to the language itself. In 2018, Facebook transferred the GraphQL project (which includes the spec, the graphql-js
reference implementation, GraphiQL, and DataLoader) to a new Linux Foundation called the GraphQL Foundation. Anyone can discuss or propose changes to the specification in its GitHub repo, graphql/graphql-spec, or in the GraphQL Working Group, a monthly virtual meeting of maintainers.
Changes to the spec go through an RFC process, and the current proposals are listed here. A few of them are:
- The
@defer
and@stream
query directives we mentioned on the Apollo Server roadmap. Adding@defer
to a field tells the server they can initially returnnull
and later fill in the data. Adding the@stream
directive to a field with a list type means the server can send part of the list initially, and further parts of the list later. These directives address the fact that currently the server only sends a single response, which means it has to wait for all data to arrive from its data sources. And that means the response time is limited by the slowest source. With@defer
and@stream
, the client can get some of the data sooner. - The
@live
query directive, which means: “send me the current value of this field, and then send me the updated value whenever it changes.” - The Input Union—creating a union type that can be used for arguments. The proposal (a.k.a. RFC) is a long document that starts with:
RFC: GraphQL Input Union
The addition of an Input Union type has been discussed in the GraphQL community for many years now. The value of this feature has largely been agreed upon, but the implementation has not.
This document attempts to bring together all the various solutions and perspectives that have been discussed with the goal of reaching a shared understanding of the problem space.
From that shared understanding, the GraphQL Working Group aims to reach a consensus on how to address the proposal.
There are also specifications in GraphQL-land other than the GraphQL spec, including the Relay Cursor Connections spec, the Relay server spec, and the in-development GraphQL over HTTP spec.
You can contribute to the future of GraphQL by:
- Building things with it!
- Contributing to GraphQL libraries and tools.
- Getting involved with the spec and foundation.
- Spreading the word.
Speaking of spreading the word, if you’d like to recommend the Guide to a friend or co-worker, we’d appreciate it 🙏🤗. https://graphql.guide
. And we’d value any feedback you may have on the book via GitHub issues or PRs.
To learn more about GraphQL, we recommend:
- Books:
- Production Ready GraphQL: An in-depth discussion of production topics.
- Advanced GraphQL with Apollo & React: A large tutorial-style book based on Apollo Federation and React.
- Course: Fullstack Advanced React & GraphQL.
- Reading the spec.