A weekly newsletter of the best news, articles and projects about GraphQL

Articles

Testing GraphQL Backend in Product Hunt

In this article, Radoslav Stankov talks about how Product Hunt tests their GraphQL API using a set of Ruby testing helpers. He goes into detail about how his team tests three categories of API code, including helpers, mutation classes, and resolver classes. Follow along to find out how to test your Ruby GraphQL APIs so you can gain confidence that they work as expected.

Hasura – my first impressions on instant realtime GraphQL API

In this article, Sebastian Kurzynowski provides his impressions on using Hasura as a realtime GraphQL API and also gives a brief tutorial on how to get up and running with it. The tutorial demonstrates how to set up authentication, how to use the Hasura GraphQL engine, and how to use Hasura actions. Follow along to find out the benefits of using Hasura and how to get started.

Introducing Direct Lambda Resolvers: AWS AppSync GraphQL APIs without VTL

AWS has just released Direct Lambda Resolvers, a solution that allows developers to build an AWS AppSync GraphQL API without the need to learn and understand VTL templates. In this announcement article, Ed Lima walks through how AWS AppSync can be beneficial for creating GraphQL APIs, the problems that arise when needing to understand VTL templates, and how developers can now create resolver logic without any VTL.

A Guide to GraphQL Errors

In this article, Marc-André Giroux provides an in-depth guide on handling errors in GraphQL. The GraphQL community has not yet settled on standard conventions for errors which can cause confusion for developers when building a GraphQL app. Marc-André's guide helps to demystify common areas of confusion and provides readers with some established best practices for GraphQL error handling.

Articles

Build a production-grade API with Prisma and GraphQL

In this article, Gabriel Colson demonstrates how to build a real-world GraphQL API with Nexus Schema and Prisma. The tutorial provides a deep-dive on application architecture, project setup, and finally implementation. Follow along with Gabriel to learn how you can easily build production-ready GraphQL APIs backed by a type-safe database access layer using Prisma.

Building well-architected serverless applications: Controlling serverless API access – part 2

In this article, idk.dev covers how to add access control to a GraphQL API built on AWS AppSync. It goes into detail about how access control should be handled, how to have AppSync verify a JSON Web Token, how to handle API keys, and more. Follow along to find out how to secure your AWS AppSync GraphQL APIs.

Understanding Client-Side GraphQL With Apollo-Client In React Apps

In this article, Blessing Krofegha does a deep-dive into how to use Apollo Client in React applications. He outlines the basics of GraphQL and how Apollo Client fits into a React application. The tutorial takes readers through how to build a React app with Apollo Client and includes instructions on queries, mutations, and how to handle the cache.

Articles

Type Safe Infrastructure, Part 2 — GraphQL APIs with AWS AppSync

In the second part of his tutorial series, Samuel Goodwin demonstrates how to set up a GraphQL API hosted on AWS AppSync. He goes into detail about the benefits of AppSync as a managed service, what some of the downsides are, and how to create and deploy a GraphQL API on it. Follow along with Samuel for in-depth instructions on how to use GraphQL on AWS AppSync.

Building a Jamstack app with Nuxt, Vue and FaunaDB

FaunaDB is becoming an increasingly popular database choice for use with GraphQL. In this article, Rami Shashati shows how to build a full-stack application with Nuxt, Vue, and FaunaDB, all with GraphQL. Follow along for an end-to-end example of building a GraphQL app using these popular technologies.

Generating TypeScript types and React Hooks based on a GraphQL endpoint

In this brief tutorial, Danilo Woznica shows how to generate both TypeScript types and React hooks from a GraphQL schema. He talks about what graphql-codegen is, how to set it up in a new project, and how to configure it to output types from a given schema.

Using Apollo’s local cache for global state management with React+Typescript, codegen, and remote resolvers

In this tutorial, Mason Goetz covers how to use Apollo for global state management in a React application built with TypeScript. He covers how to set up local queries and mutations, how to use the GraphQL schema locally for type definitions and codegen, and how to use graphql-codegen to create custom hooks.

Articles

Announcing the Release of Apollo Client 3.0

Apollo has just announced the official release of Apollo Client 3.0. The major version bump brings package consolidation, improvements to the InMemoryCache APIs, improved local state management, and improvements to UI reactivity. Follow along as Ben Newman goes in-depth on the changes in Apollo Client 3.0, including some extensive code samples.

Search Kubernetes World with GraphQL

Searching through related Kubernetes resources can be complicated with existing tools. In this article, Hiroyuki Osaki explains why GraphQL is a good candidate for making this task simpler. He also demonstrates how to set up a working Kubernetes search client using GraphQL.

Articles

New Gatsby Source WordPress Plugin Now in Beta

Gatsby recently announced their new plugin for WordPress which is now in beta. One of the ways to use the plugin is with GraphQL using WPGraphQL by Jason Bahl. This article covers some of the technical details around the WPGraphQL plugin and how it interacts with WordPress data. Specifically, with the WPGraphQL plugin, WordPress can be used as a headless CMS. The article also gets into some of the motivations behind WPGraphQL and the benefits it offers over REST.

Articles

Announcing Hasura Cloud: Managed GraphQL for your database and services

Hasura has just released their managed cloud service based on the popular Hasura GraphQL engine. With Hasura Cloud you can offload many of the operational concerns that hosting a GraphQL server requires, like maintaining servers rate-limiting, high-availability, monitoring, tracing, and caching. Hasura cloud adds support for caching with a @cache directive that can be added to GraphQL queries making it like a CDN for dynamic data. Check it out to learn more about how Hasura Cloud makes the GraphQL server an invisible part of your infrastructure.

Deriving A Data Model From A Design With GraphQL

Data modelling is an necessary skill at all levels of the software development stack. Typically it's done prior or during implementation of services. In this piece, Andrew does an interesting exercise of doing the reverse – deriving a GraphQL data model by looking at single screen or page from an app. Read along if you're looking to level up your data modelling skills or have a better understanding of the mapping between UIs and a GraphQL API.

Articles

GraphQL directives are underrated

In this article, which is part of a series about different aspects of GraphQL implementations, Leonardo delves into an often overlooked feature: GraphQL specification–directives. Leonardo argues why directives are among the most powerful features in GraphQL, showing how they can enhance and empower our APIs, and explaining why servers with good support for custom directives will lead the way into the future of GraphQL.

How and why GraphQL will influence the SourceHut alpha

In this opinion piece, Drew, author of the open-source software development platform SourceHut, offers a glimpse into the role of GraphQL in SourceHut's development and architecture. Drew details the opportunity represented by migrating from Python backends that communicate directly with PostgreSQL to backends that communicate with a GraphQL API that serves as a single source of truth. He reasons this incremental change as one that could substantially increase his confidence in the system while improving performance and reliability.

Articles

On GraphQL-to-SQL

Learn more about the landscape of tools that map GraphQL to SQL. As GraphQL gains wider adoption, many tools and patterns emerge to ease the job of mapping GraphQL queries to SQL queries. In this thoughtful article Marc-André Giroux, the author of Production Ready GraphQL, explores the popular tools, the different features they offer, and reasons why some tools are better fit for new projects and others for adoption in existing codebases.

Nulls in GraphQL: Cheatsheet

In this article, Sezgi goes into what nulls mean in GraphQL and the spec's approach to nullability and error handling. Read more about how that connects with the approaches taken by Apollo and Relay. An interesting read for those looking to master nulls in GraphQL with a useful cheatsheet for quick reference.

A Deep Dive on Apollo Data Sources

GraphQL makes it easy for clients to fetch data from servers. But how does a GraphQL server source that data in the first place? Apollo Server data sources are a collection of classes that encapsulate the code for interacting with different data services, e.g. Mongo DB, REST API. Read along to learn about the current state of data fetching and how to write your own data source library

Demystifying GraphQL Connections

The GraphQL connection specification is a pattern for implementing cursor-based pagination. This article by Andrew Ingram addresses common misconceptions around it and the reasons for choosing connections as a pagination implementation over limit-offset pagination. Check it out to learn about the patterns, the role of edge types, and GraphQL schema examples.

Articles

How to secure a GraphQL service using persisted queries

In this article, Christoph suggests persisted queries as an approach to improving the security (and performance) of GraphQL APIs. The working argument is that while GraphQL provides a lot of flexibility, it also exposes a lot of information that can increase attack vectors. The approach suggested is a kind of security through obscurity whereby instead of sending queries to the API, you send the hash of a query and the API maintains a list of allowed query hashes. The article covers some of the limitations of this approach and similar solutions in the ecosystem. Follow along for an interesting read.

Designing GraphQL schemas

Designing the GraphQL schema is often the first step in your app development journey using GraphQL. This guide presents an intuitive, straightforward process to design your GraphQL schemas and modify them as your application UIs become increasingly complex.

Hasura: Introducing Actions

This blog post introduces a technique to add custom business logic to your GraphQL API with Hasura Actions. Understand all the benefits of this architecture, such as the ability to work on new or existing databases, specify Hasura authorization rules, and be served by a serverless function. Check out how to get started with Hasura and actions with the documentation provided at the end of the blog!

Articles

Relay: the GraphQL client that wants to do the dirty work for you

A series of articles by Gabriel Nordeborn and Sean Grove diving into Facebook's GraphQL client Relay. They cover what Relay is, why it's beneficial for application development, and why you should care. By following GraphQL best practices and Relay's conventions, it can give you a great developer experience. Moreover, they show how Relay can help in building maintainable, scalable, and performant applications.

How dataloader-codegen autogenerate DataLoaders for your GraphQL Server

Learn more about the motivations and lessons learned by Yelp while building the recently open-sourced dataloader-codegen library. The library can autogenerate type-safe DataLoaders for your GraphQL server and attempts to reap the benefits of DataLoaders while shifting developer focus from DataLoader implementation details to thinking in data resources. Especially interesting how they leverage type safety and code generation, as we see both techniques rising in popularity in the GraphQL and web development ecosystem.

The Biggest GraphQL Misconceptions

An article about three common misconceptions about GraphQL from the author of Production Ready GraphQL. Marc-André starts with how GraphQL APIs, despite serving as a typed reference, are not self-documenting on their own and benefit from usage examples. Second, on breaking API changes he explains that GraphQL is not inherently version-less, even though it favors evolution over versioning. Third, GraphQL is not a data language as it does not standardize filtering, pagination, and ordering.

Articles

An Introduction to GraphQL: Subscriptions

Building real-time applications can be made easier with GraphQL subscriptions. In this article, Peter explains what they are and how they work with code samples for a Node.js implementation.

Three awesome tools for GraphQL developer experience

In this post, Natalia shares useful tools for an improved developer experience when developing GraphQL APIs. Covering GraphQL playground, IDE plugins, and the Apollo DevTools browser extension. Check these out if you don't already for a smooth development experience.

The Graph in GraphQL

In a thought-provoking piece, Bogdan delves into the underlying principles behind GraphQL. Follow along to learn more about data structures such as trees and graphs and how they are used in GraphQL to handle requests. Bogdan argues that graphs are a natural fit for APIs as they are expressive in representing the problem space. Moreover, they allow for efficient parallel fetching as is often necessary with relational databases.

Versioning fields in GraphQL

GraphQL APIs evolve together with applications to meet new needs. In this articulate article, Leonardo shows how to version fields as a way to introduce changes while avoiding breaking the API for consumers. Leonardo first explains the challenges with the common evolution strategy whereby you add new fields and deprecate old ones. Then he introduces how field versioning is used to introduce changes to the API using a version argument for fields that are handled by resolvers.

Articles

GraphQL in JavaScript: An Introduction

An introductory article for GraphQL, this article has a nice addition in that it offers up an example with an express endpoint and finally gives some further information on working with GraphQL, including error handling and middleware.

Articles

GraphQL In Action: Introduction

Check out the entire first chapter of GraphQL in Action by Samer Buna. The chapter is beginner-friendly and covers the what, why, and challenges that GraphQL comes with.

What is the N+1 problem?

A repost of an informative article on the N+1 problem which comes up when fetching related data entities in GraphQL resolvers. Learn more about the N+1 problem and solution in this article written by the author of Production Ready GraphQL.

GraphQL and Graph Databases

An insightful and opinionated take on the synergies and inherent differences between GraphQL and graph databases. Paul argues that although GraphQL is a helpful interface for Graph Databases, GraphQL technically has little to do with Graph Databases.

Articles

GraphQL Lessons After 4 Years: Scaling Subscriptions

Learn from Matt's insights based on his four years of experience building with and scaling GraphQL subscriptions through trial and error. The post covers GraphQL subscription basics and then details his learnings in a series of concise tips.

GraphQL beyond the buzzword; When to use GraphQL

A thought-provoking article covering the situations where GraphQL provides value. GraphQL has many advantages, but it isn't a magic bullet for all API problems. In this article, Shani does an in-depth cost-value analysis of GraphQL adoption and provides a useful decision table to help you decide.

Articles

Chaining Graphql Resolvers

This post breaks down the problems of GraphQL resolvers and offers some solutions by creating a chain of resolvers to satisfy individual parts of the overall problem. By doing so, these resolvers can be reused, tested easily and make code more expressive. Abhishek Saha demonstrates through sample code how chaining resolvers helps write schemas quickly to improve server side development.

Caching GraphQL Responses

To support offline capabilities, learn how to cache GraphQL responses by implementing a GraphQL caching in service workers with the caches API. Abdelrahman Awad explains the differences between caching as part of an application logic layer and caching as an enhancement layer, focusing more on the latter. The post also explains the fundamental distinctions between RESTful caching and GraphQL caching, and how GraphQL caching is transport agnostic.

Articles

GraphQL for beginners

In this post, Danijel gives a soft introduction to GraphQL with some useful analogies for developers coming from REST style APIs. Danijel uses diagrams to show how GraphQL queries are resolved on the server side.

Optimization GraphQL resolvers with lookaheads

Follow along with Boopathi as he explains what lookaheads are and how they can improve your GraphQL server. Boopathi demonstrates the situations in which it's possible to utilize lookaheads and how to use this technique to only fetch necessary fields, reducing both DB load and unnecessary traffic.