GraphQL is the response to growing REST endpoints which often don't match up to the data that the client needs. They may return too much data (over-fetching) which results in excessive payload size. They may also return too little data (under-fetching) which results in making subsequent API calls to fetch remaining data. GraphQL solves this problem by creating a system where clients request the data that they need and receive nothing beyond that. This allows for more performant applications through reduced payload sizes and API calls. These benefits are compounded when considering higher network latencies on mobile devices and generally reduced computing power for non-flagship products.
- Graphql.org: Read about the specification and find additional resources on the official homepage for GraphQL
- Best Practices: An excellent source for some good general practices when working with GraphQL
- Learning GraphQL Book: Eve Porcello and Alex Banks do an excellent job of breaking down what makes up a GraphQL API as well as how to create an application involving oAuth, uploading files, and more. Rich with code examples and best practices.
- The Road to GraphQL Book: A free book by Robin Wieruch which dives into the pros and cons of GraphQL as well as how to get started with Apollo on both the client and the server.
- Apollo's Tutorial: Apollo’s tutorial walks through how to create a full stack application in GraphQL including wrapping an existing REST API with GraphQL
- GraphQL Stack: A great resource that aggregates GraphQL tools by language
- Pinboard: I aggregate interesting links related to GraphQL here
- GraphQL Weekly: A weekly newsletter about GraphQL
- Build Better and More Discoverable APIs with GraphQL - Skyler Lemay: Discover the problems GraphQL solves compared to REST, the impact of network latency, as well as an introduction to Schema, Resolvers, and Queries. A good introduction into Why GraphQL.
- Everything you Need to Know about GraphQL in 3 Components - Eve Porcello: An excellent walkthrough of using GraphQL Queries, Mutations, and Subscriptions complete with an amazing live demo
- JS Party - REST easy, GraphQL is here: Hear from a John Resig and how Khan Academy has been using GraphQL
- Testing GraphQL - Jake Dawkins: Jake gives an excellent introduction to various levels of testing GraphQL clients and servers
- GraphQL Schema Design @ Scale - Marc André Giroux: Marc shares his perspectives on how to best maintain a Schema as it scales, after seeing both good and poor implementations
- Hard Learned GraphQL Lessons: Based on a True Story (Natalie Qabazard & Aditi Garg): Aditi and Natalie share pragamatic tips and best practices from their work with GraphQL at Trulia
More companies are embracing GraphQL in production and to drive their applications. Check out some of the case studies below for more information on why they made these decisions and some of the impacts they observed.
Public GraphQL APIs
The biggest challenge can often be where to start actually interfacing with an API. Below are a handful of publically accessible GraphQL APIs that you can connect to and experiment querying data and building out a project
- Github: Retrieve information about Github users and their repositories. For more information on why Github chose to build the API with GraphQL over REST, check out their announcement post
- Yelp: This highlights the benefits of GraphQL's declarative data structure. Retrieve only the data that you need for certain businesses and queries for reduced payload sizes.
- Star Wars API: This API can be a great introduction not only into GraphQL but having nested queries which would normally result in multiple round trips if the client was using REST.
- Other Public GraphQL APIs: This repo collects other publicly accessible GraphQL APIs
- Gatsby: While not a GraphQL API, Gatsby uses GraphQL for its data layer and has a large selection of plugins to connect to various data sources and create GraphQL queries for you. It is a great site building tool with performance as a top priority.