# Using feature flags in GraphQL

DevFeed: [Using feature flags in GraphQL](<https://devfeed.tech/articles/using-feature-flags-in-graphql-25672.md>)

Original publisher: [Read original article](<https://adambennett.dev/2024/09/using-feature-flags-in-graphql/>)

Published: 2024-09-10T19:42:33Z

Content type: tutorial

Language: en

Sources: [Posts on Adam Bennett](<https://devfeed.tech/sources/posts-on-adam-bennett.md>)

Topics: [GraphQL](<https://devfeed.tech/topics/graphql.md>), [feature flags](<https://devfeed.tech/topics/feature-flags.md>)

Tags: [algorithms](<https://devfeed.tech/tags/algorithms.md>), [android](<https://devfeed.tech/tags/android.md>), [apollo](<https://devfeed.tech/tags/apollo.md>), [blog](<https://devfeed.tech/tags/blog.md>), [career](<https://devfeed.tech/tags/career.md>), [compose](<https://devfeed.tech/tags/compose.md>), [development](<https://devfeed.tech/tags/development.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [feature-flags](<https://devfeed.tech/tags/feature-flags.md>), [finance](<https://devfeed.tech/tags/finance.md>), [functional](<https://devfeed.tech/tags/functional.md>), [graphql](<https://devfeed.tech/tags/graphql.md>), [growth](<https://devfeed.tech/tags/growth.md>), [java](<https://devfeed.tech/tags/java.md>), [jetpack](<https://devfeed.tech/tags/jetpack.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [money](<https://devfeed.tech/tags/money.md>), [opinions](<https://devfeed.tech/tags/opinions.md>), [software](<https://devfeed.tech/tags/software.md>), [startups](<https://devfeed.tech/tags/startups.md>), [thoughts](<https://devfeed.tech/tags/thoughts.md>), [training](<https://devfeed.tech/tags/training.md>), [tutorial](<https://devfeed.tech/tags/tutorial.md>)

## AI overview

This tutorial explains how GraphQL directives can conditionally include fields in queries. It shows how passing a feature flag to a directive, including with Apollo, can prevent risky new fields from triggering backend requests and causing an entire query to fail.

## Source excerpt

I've been using GraphQL in some form or another for a couple of years now, and I have... opinions about it. Opinions notwithstanding, it's a supremely flexible and powerful tool, and I just want to highlight something here that it seems quite a few people don't know about. That something is Directives, which is a way of optionally including fields. But why is this useful?