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.
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.
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
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.
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 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.
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!
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
This post explores some of the complications faced when designing the mutations part of a GraphQL API and the best practices to follow based on the Relay's API spec for mutations. David Chanin explains how these practices are applicable more generally, even if you're not using Relay on the frontend.
A thought provoking and opinionated post about the semantic differences between GraphQL and REST and how they can't be directly compared as one is a query language while the other is an architectural style. Fagner Brack challenges in the post common conventions and includes a list of interesting resources on the topic.
This blog goes in-depth on the origins of federation, the design and implementation of a federated graph architecture, the components of federation, and more. The article explains how federated architecture, although fairly new, helps simplifies, in a highly optimized manner, the problem of bringing multiple schemas from different micro services together and merging them into one unified graph API.
Check out this tutorial that demonstrates how to use multiple databases in Neo4j 4.0 and how to use multiple active databases with the Neo4j GraphQL integration, building a multi-tenant GraphQL API. William Lyon includes example code on how to setup and create a GraphQL schema and Neo4j driver instance. He also provides resources at the end of the tutorial for more information on multi-database support with Neo4j and GraphQL.
This post explores the important performance considerations for building apps at scale and how Hasura GraphQL Engine leverages PostgreSQL query caching and prepared statements to improve performance. Some interesting metrics are provided as the article breaks down the multiple stages of processing an incoming GraphQL query. Praveen Durairaju explains how Hasura’s architecture allows for GraphQL query plans to get cached and SQL query plans to get cached by Postgres with prepared statements.
Sarah Drasner shares the advice and notes from a NodeSF meetup where Francesca Guiducci gave a talk on A GraphQL Guide for Backend Developers. This post dives into how to determine if GraphQL fits into your architecture, whether it’s putting a GraphQL server in front of a database or using GraphQL as a wrapper around existing APIs. She further explains the details and best practices of schema design, providing examples while sharing the challenges that come with using GraphQL.
This article discusses an approach to GraphQL schema design that involves both non-technical domain experts and developers. Khalil Stemmler takes you step by step using event storming to design and build a GraphQL schema, showing the different use cases for when CRUD doesn’t fit.
In this article, Sean Dearnaley explains the powerful combination of TypeScript and GraphQL and the learning outcomes of type safety. These tools combined offer the ability to construct powerful and practical programming interfaces that can be used by all GraphQL consumers. Learn how to evolve an API without endpoint versioning by using Typescript.
This article by Andi Marek provides a deep deep dive into scalars. The article helps readers understand GraphQL scalars and learn how to write custom ones. The examples provided within the article are in GraphQL.js but the focus is on the fundamental concepts, especially Coercion.
With the start of each year predictions and discussions about the upcoming trends in GraphQL are becoming a tradition. In his recent article, Marc-Andre Giroux covers some of the trends he expects this year. He speaks to transport specific implementations/optimizations, alternative execution algorithms/engines, and a greater focus on GraphQL's tradeoffs.
MongoDB has added support for GraphQL in its cloud DB service, MongoDB Atlas. This New Stack article covers the details of the launch, how the functionality was integrated with Mongo and what requirements the company outlines to get started with the feature.
An illustrated article with helpful sketches, Stav Barak's introduction to GraphQL is a great summary about the technology for people curious to learn about what GraphQL is and does. Covering the advantages that GraphQL has over REST, Stav offers up examples throughout the piece. A great article for newcomers to GraphQL.
This in-depth article introduces the concept of discriminated/tagged unions in GraphQL and how to leverage them to write more extensible applications. The article includes examples of GraphQL unions and how they are represented as tagged unions at runtime. Kevin Saldaña also discusses ReasonML and demonstrates the power of variants and pattern matching in Reason. He explores the power of Hindley-Milner type inference and pattern matching, which can be combined to efficiently write highly type-safe applications.
Sebastian Scholl from the 8base team shares how they were able to build a full-featured group and aggregations enabled GraphQL API with direct SQL access while still within the confines of GraphQL. Sebastian runs through how they utilize aliases that allows for dynamic types and attribute-names to be used.
Learn about the potential ways to resolve data for a GraphQL endpoint using RESTful APIs and how to utilize Apollo’s REST Data Source library in Khalil Stemmler’s deep dive into an optimized GraphQL server. Find out how request dedication and resource caching works in REST Data Source. The article also provides tips to implement your own resource cache using the apollo-server-caching library.
This article discusses some advanced topics using GraphQL with Apollo SDK and Swift, including the usage of GraphQL fragments and Swift scalar types as well as the pros and cons to using GraphQL. Kristaps Grinbergs demonstrates how to use your own types for custom scalars and improve your code base with custom initializers for your app models.
In this article, learn more about the unexpected quirks to web application behavior that GraphQL introduces. The article runs through how the technique of batching works and how it can cause security problems, such as the inconsistencies of implementations, mutation operations that work with user authentication, and more. At the end, the article offers some tips on how you can safely secure your GraphQL applications against batching attacks.
This article speculates the benefits of combining GraphQL and the Semantic Web because of the commonalities between the two technologies. Some core Semantic Web mechanisms and existing resources can help enhance GraphQL data integration and its publishing capabilities. Szymon Klarman provides interesting commentary on how GraphQL and URIs can open the door to global knowledge graphs and improved data environments.
This blog takes a look into performing GraphQL queries and how to configure your project to communicate with a sample API. Joe Birch introduces a GraphQL setup with coroutines and how it can improve the approach to asynchronous operations. He provides sample code throughout the article to explain how to utilize GraphQL schemas and queries to build out a project.