😳 GraphQL directives are underrated

— 2 minute read

Not many articles (if any) comparing REST and GraphQL mention directives to be a key differentiator. Yet, I believe that directives are one of the most powerful features in GraphQL, which alone justifies migrating an API from REST to GraphQL.

Coming from this realization, I wrote piece GraphQL directives are underrated to bring out all the beauty from directives:

  • What are directives
  • What different types of directives there are
  • How they make GraphQL better
  • Why directives are still not perfect

As I argue in my article, because most (if not all) new development in GraphQL is initiated through directives, GraphQL servers with good support for custom directives will lead GraphQL into its future. Conversely, APIs implemented on servers with poor support may eventually become stagnant, making them a poor investment for the long-term.

Hence, when searching for a GraphQL server for your new API, priority should be given to their support for custom directives. This is such a strong belief for me, that I coded GraphQL by PoP (my own GraphQL server, implemented in PHP) to have directives as its very architectural foundation. Even calling resolvers is executed through a directive!

(Btw, this will be the topic of the upcoming article on my GraphQL series 😎)


Piece GraphQL directives are underrated is part of a series I'm writing for the LogRocket blog, where I explain my journey on conceptualizing, designing and implementing a GraphQL server, as I have done for GraphQL by PoP.

Enjoy!