Skip navigation

Use GraphQL with Kontent

GraphQL is a query language designed to decouple the data an app needs from the queries required to fetch it. You can think of GraphQL as a middleman between your app and your Kontent project. It lets you query content from your Kontent project without worrying about the underlying API specifics. This article lists several options for using GraphQL with Kontent.

The SDKs, tools, or plugins mentioned on this page are maintained by our community. If you have questions or want to report bugs, we recommend submitting issues in the appropriate GitHub repository. Feel free to pitch in with your improvements as well.

Table of contents

    Using GraphQL through Apollo server

    You can fetch content from Kontent projects through GraphQLOpens in a new window queries by using our boilerplate for Express.js appsOpens in a new window. To enable execution of GraphQL queries, the boilerplate uses an Apollo server as a converter from the Kontent Delivery API to GraphQL. If you don't want to use Express.js in your app, you can also integrate Apollo with other Node.js middlewareOpens in a new window, such as FastifyOpens in a new window, KoaOpens in a new window, or HapiOpens in a new window.

    Generating GraphQL schemas for your content types

    To make your work with GraphQL easier, we recommend using a GraphQL schema generator. The schema generator takes a look at the content types and elements in your Kontent project and transforms them into objects understandable by GraphQL. See the schema generator tool on GitHubOpens in a new window for usage instructions and more examples.

    Using GraphQL through Gatsby

    Gatsby is a static site generator based on React. If you're building a static site using Gatsby, you might want to use GraphQL queries to fetch content. We provide a source plugin for GatsbyOpens in a new window that creates GraphQL nodes for the content in your Kontent project.

    See how to source contentOpens in a new window for your Gatsby site from Kentico Kontent. The tutorial walks you through setting up a Gatsby site from scratch and teaches you the basics of using the source plugin to get your content.

    Using GraphQL through Gridsome

    Gridsome is a Vue.js static site generator that fetches content using GraphQL. Find the Gridsome source plugin on GitHubOpens in a new window for usage instructions and examples.