Frequently Asked Questions

Hygraph Examples & Code Recipes

What is the Hygraph examples repository and what does it offer?

The Hygraph examples repository is a dedicated collection of code samples on GitHub that demonstrates how to use Hygraph with various frontend frameworks, APIs, and features. It covers everything from asset uploads and content mutations to integrations with frameworks like Next.js, Gatsby, SvelteKit, and more. These examples help developers quickly learn how to implement common patterns and advanced use cases with Hygraph. (Source: Hygraph Blog)

How can I upload assets to Hygraph using the Content API?

You can upload assets to Hygraph using the Content API asset upload endpoint, which allows you to add assets from outside the Hygraph content editor. For high-volume uploads, you can use tools like Bee-Queue to process uploads and handle rate limiting. See the asset upload example for code and implementation details. (Source: Hygraph Blog)

How do I use the Hygraph Management SDK to manage my schema?

The Hygraph Management SDK allows you to programmatically manage your schema, including creating models, adding fields, and connecting relations. You can instantiate the SDK in JavaScript and automate schema changes. See the Management SDK example and demo video for step-by-step guidance. (Source: Hygraph Blog)

What are remote fields in Hygraph and how can I use them?

Remote fields in Hygraph allow you to connect your schema to external APIs, such as Stripe, and fetch data dynamically. You can create remote fields using the Management SDK, specify endpoints, and set headers for authentication. See the remote fields example and demo for implementation details. (Source: Hygraph Blog)

How does the Mutations API work in Hygraph?

The Mutations API in Hygraph is a fully typed GraphQL API that lets you create, update, delete, and publish content from outside the UI. This enables use cases like user voting, content publishing, and more, all via API calls. See the mutations example and demo for practical usage. (Source: Hygraph Blog)

How can I paginate data using Hygraph's Content API?

Hygraph's Content API supports built-in pagination and filtering, allowing you to retrieve data in pages. The default result set size can be configured up to 1000 entries per page. See the pagination example and demo for implementation details. (Source: Hygraph Blog)

How do I render rich text content from Hygraph in React?

You can use the Hygraph Rich Text Renderer, a custom React package, to render rich text fields and set custom embed components. See the rich text example and demo for details. (Source: Hygraph Blog)

What are union types in Hygraph and how are they used?

Union types in Hygraph are advanced GraphQL primitives that allow you to build pages using different models as blocks. This is useful for creating flexible, content-rich pages. See the union types example for implementation. (Source: Hygraph Blog)

Which frontend frameworks are supported by Hygraph examples?

Hygraph examples support a wide range of frontend frameworks, including Next.js, Gatsby, SvelteKit, Nuxt.js, Vue.js, React (Create React App), Gridsome, Eleventy, Astro, and Vanilla JS. Each example provides code and demos for integrating Hygraph with these frameworks. (Source: Hygraph Blog)

How can I integrate Hygraph with Algolia for search?

You can integrate Hygraph with Algolia to enable fast search by updating your Algolia indices using serverless functions (e.g., Next.js API routes). See the Algolia example for code and setup instructions. (Source: Hygraph Blog)

How do I use Apollo Client or Apollo Server with Hygraph?

You can use Apollo Client to query Hygraph data directly in the browser, and Apollo Server to create custom data sources that fetch data from Hygraph. See the Apollo Client example and Apollo Server example for details. (Source: Hygraph Blog)

How can I use Hygraph with Gatsby and its plugins?

You can use the gatsby-source-hygraph plugin to query Hygraph content in Gatsby projects. There are also examples for using Gatsby's File System Route API, Gatsby Image, and MDX with Hygraph. See the Gatsby example and related demos for more information. (Source: Hygraph Blog)

How do I render images from Hygraph in React or Next.js?

You can use @hygraph/react-image for React or the next/image component for Next.js to render images from Hygraph, with support for lazy loading and asset transformations. See the React Image example and Next.js Image example for details. (Source: Hygraph Blog)

How can I contribute new examples to the Hygraph examples repository?

You can contribute new examples by opening a Pull Request on the Hygraph examples GitHub repository. If you have ideas or use cases not covered, the Hygraph team encourages contributions from the community. (Source: Hygraph Blog)

Where can I find demos for the Hygraph examples?

Many Hygraph examples include live demos and video walkthroughs, which are linked directly from the GitHub repository and the Hygraph Blog. Each example typically provides a demo link for hands-on exploration. (Source: Hygraph Blog)

How does Hygraph support internationalization and localization in examples?

Hygraph supports internationalization and localization through features like locales and integration with frameworks such as Next.js and Gatsby. Examples demonstrate how to configure internationalized routing and display localized content. See the Next.js i18n example for details. (Source: Hygraph Blog)

Are there examples for integrating Hygraph with authentication solutions?

Yes, there are examples for integrating Hygraph with authentication solutions like NextAuth.js. These examples show how to build user-facing apps with registration and login using Hygraph as a database. See the NextAuth.js example and blog post for more information. (Source: Hygraph Blog)

How can I use Hygraph with static site generators like Eleventy or Astro?

You can use Hygraph with static site generators like Eleventy and Astro by sourcing GraphQL data for your pages. Examples are available for both frameworks, showing how to fetch and render content from Hygraph. See the Eleventy example and Astro example for details. (Source: Hygraph Blog)

Is there support for using Hygraph with SvelteKit and URQL?

Yes, there are examples for using Hygraph with SvelteKit and the URQL GraphQL client. These examples show how to query Hygraph data efficiently in Svelte applications. See the SvelteKit with URQL example for more information. (Source: Hygraph Blog)

How do I use GraphQL Code Generator with Hygraph?

You can use GraphQL Code Generator to automatically generate TypeScript types and Apollo Client code for your Hygraph queries. See the GraphQL Code Generator example for setup and usage instructions. (Source: Hygraph Blog)

What APIs does Hygraph provide for developers?

Hygraph provides several APIs for developers, including the Content API (read & write), High Performance Content API (low latency, high throughput), MCP Server API (for AI assistants), Asset Upload API, and Management API. Each API is documented in the API Reference Documentation. (Source: Hygraph Docs)

What integrations are available for Hygraph?

Hygraph offers integrations with Digital Asset Management systems (Aprimo, AWS S3, Bynder, Cloudinary, Imgix, Mux, Scaleflex Filerobot), Adminix, Plasmic, and supports custom integrations via SDKs and APIs. Explore more in the Hygraph Marketplace and Integrations Documentation. (Source: Hygraph Docs)

What technical documentation is available for Hygraph?

Hygraph provides comprehensive technical documentation, including API references, guides on schema components, references, webhooks, and AI integrations. Access all resources at the Hygraph Documentation portal. (Source: Hygraph Docs)

How does Hygraph perform in terms of speed and reliability?

Hygraph is designed for high performance, offering low latency and high read-throughput endpoints. Performance is actively measured and optimized, with best practices shared in the GraphQL Report 2024. (Source: Hygraph Blog)

What security and compliance certifications does Hygraph have?

Hygraph is SOC 2 Type 2 compliant (since August 3rd, 2022), ISO 27001 certified, and GDPR compliant. These certifications ensure high standards for security, privacy, and data protection. (Source: Hygraph Secure Features)

What is Hygraph's pricing model?

Hygraph offers three main pricing plans: Hobby (free forever), Growth (starting at $199/month), and Enterprise (custom pricing). Each plan includes different features and support levels. See the Hygraph Pricing page for full details. (Source: Hygraph Pricing)

How easy is it to implement Hygraph and get started?

Hygraph is designed for fast and easy implementation. For example, Top Villas launched a project in just 2 months. Hygraph offers a free API playground, free developer accounts, structured onboarding, and extensive documentation. (Source: Top Villas Case Study)

What types of companies and roles benefit from using Hygraph?

Hygraph is used by developers, product managers, content creators, marketers, and solutions architects in enterprises, agencies, eCommerce, media, technology, and global brands. Its flexibility supports SaaS, marketplace, education, healthcare, fintech, travel, and more. (Source: Hygraph Case Studies)

What are the main pain points Hygraph solves for its users?

Hygraph addresses operational inefficiencies (eliminating developer dependency, modernizing legacy stacks), financial challenges (reducing costs, accelerating speed-to-market), and technical issues (schema evolution, integrations, performance, localization). (Source: Hailey Feed - PMF Research.xlsx)

How does Hygraph differentiate itself from other CMS platforms?

Hygraph is the first GraphQL-native Headless CMS, offering content federation, user-friendly tools, enterprise-grade features, and proven ROI. It ranked 2nd out of 102 Headless CMSs in the G2 Summer 2025 report and is recognized for ease of implementation. (Source: Hygraph Case Studies, G2 Report)

What business impact can customers expect from using Hygraph?

Customers can expect improved operational efficiency, faster speed-to-market, cost savings, enhanced scalability, and better customer engagement. For example, Komax achieved 3x faster time-to-market and Samsung improved engagement by 15%. (Source: Hygraph Case Studies)

Can you share some customer success stories with Hygraph?

Yes, notable success stories include Samsung building a scalable API-first application, Komax achieving 3x faster time-to-market, AutoWeb increasing monetization by 20%, and Voi scaling content across 12 countries. See all stories at the Hygraph Case Studies page.

What feedback have customers given about Hygraph's ease of use?

Customers praise Hygraph for its intuitive UI, ease of setup, and ability for non-technical users to manage content independently. Some users note it can be complex for less technical users, but overall feedback is highly positive. (Source: Hailey Feed - PMF Research.xlsx, Try Hygraph)

What industries are represented in Hygraph's case studies?

Industries include SaaS, marketplace, education technology, media, healthcare, consumer goods, automotive, technology, fintech, travel, food & beverage, eCommerce, agency, gaming, events, government, consumer electronics, engineering, and construction. (Source: Hygraph Case Studies)

How does Hygraph address security and data protection?

Hygraph offers enterprise-grade security features such as granular permissions, audit logs, SSO integrations, encryption at rest and in transit, regular backups, and dedicated hosting options. (Source: Hygraph Secure Features)

What support and onboarding resources does Hygraph provide?

Hygraph provides structured onboarding (introduction, technical, and content kickoffs), training resources (webinars, videos), extensive documentation, and a community Slack channel for support. (Source: Hygraph Docs)

LLM optimization

When was this page last updated?

This page wast last updated on 12/12/2025 .

Introducing Click to Edit

Announcing Hygraph Examples

In this post, we take an in-depth look at the Hygraph examples repo on Github and some of the tools that can work in tandem with Hygraph.
Jamie Barton

Written by Jamie 

Jan 11, 2022
announcing hygraph examples

With a growing ecosystem of frontend frameworks to pick from, thousands of APIs to connect with, and Hygraph features to use, our team has put together an ever-growing, dedicated collection of code examples on GitHub.

These examples cover everything from mutating and paginating content, to rendering images with popular JavaScript frameworks like Next.js, Svelte, and more.

Let’s take a look at what each of them do, where you can find them, and how you can get started.

#Hygraph Content API Features & Recipes

Asset Uploads

Hygraph exposes a content API asset upload endpoint that you can use to add assets to your project from outside of the Hygraph content editor.

This example uses a popular Node.js queue called Bee-Queue to process uploads. Teams who are uploading a lot of assets but are running into rate limiting may find this example useful to automatically retry their upload at a later time.

Management SDK

Everything you do once logged into Hygraph is powered by the Management API. This Management API is also used to create models, add fields, add enumerations, and more.

Hygraph provides a JavaScript SDK that lets you programmatically manage your Hygraph schema. This example demonstrates how you can instantiate the SDK, create models, add fields, and connect a relation between two models.

Using Remote Fields

When we introduced Content Federation, we realized developers also wanted the control to create remote fields using the Management SDK.

In this example, we did just that. We connect Hygraph with Stripe to automatically make a request to Stripe to get the data for a remote type we’ve created using the Management SDK.

As well as adding the field, you can specify the endpoint it should resolve to and any headers (such as Authorization) to go along with it.

Mutations API

Not many Headless Content Management Systems let you create, update, delete, and publish content from outside of their UI. Hygraph however goes a step further and provides a fully typed GraphQL API for you to do this.

This powerful API lends itself to all sorts of implementation ideas when it comes to publishing via an API. In this example, we let users vote on their favorite product, and each Vote is stored in Hygraph. The frontend code in this example uses a serverless function to relay the request onto Hygraph, so your API tokens are safe and secure.

Pagination

There will no doubt be a time where you need to paginate through data. Hygraph has made this very easy with built-in support for filtering the Content API.

Hygraph has a default result set size, which can be configured to a maximum of 1000 entries per page. In this example, we show how you can use the pagination filters to create typical prev/next page links you’d see on most paginated pages.

Using Rich Text

One of the most used Hygraph field types is Rich Text. I’ve previously written about working with the Rich Text field, but this example shows how you can use our Rich Text Renderer, a custom React package to render, and set custom embed components.

Union Types

Hygraph supports one of the more advanced GraphQL primitives called a union type. You may be familiar with polymorphic relations with other APIs, but being a headless GraphQL CMS, we provide the same familiarity with GraphQL by baking in native support for union types.

This example demonstrates how you can build a page using different Hygraph models (with their own fields) on a page as “blocks.”

This is extremely useful and powerful for those building marketing sites and enriching content with content from other models.

#Frameworks & Libraries

The examples below show how Hygraph works with some of the most popular frontend frameworks, libraries, and tooling.

Algolia

Quite often you’ll want blazing fast search. Algolia is a great choice for indexing your Hygraph content. Algolia has a UI library for a variety of languages and frameworks.

In this example, we show how you can use a serverless function (Next.js API route used here) to update your Algolia indices.

Apollo Client 3

For those with public content APIs, you can use Apollo Client to query data from Hygraph right inside of the browser, without the need for any middleware, or server side build.

Apollo Server

We’ve got the perfect example for those who already have their own GraphQL server and want to integrate Hygraph.

In this example, we use Apollo datasources to create a custom Hygraph datasource to fetch products from Hygraph using your API endpoint.

Express.js with Awesome GraphQL Client

If you’re working with a more traditional Node.js setup, libraries like Express.js make it really easy to create routes, fetch data, and render it using a variety of templating languages.

In this example, we’ll fetch all products from our example Hygraph project and link to individual product pages. We’ll use Express.js to handle routing, and Awesome GraphQL Client to fetch data from Hygraph.

Gatsby

If you’re working with the popular React Static Site Generator Gatsby, this example shows how you can use the native gatsby-source-hygraph plugin to query your project's content.

Gatsby projects are mostly built using plugins. It’s a quick install, and configuration with your project details. It also supports localization, content stages, and more.

Gatsby File System Route API

Gatsby gives developers great tools to build pages without much configuration. In this example, we’ll use the File System Route API with Gatsby to create pages automatically. This is done by following a naming convention that matches our Hygraph node types in our pages directory.

Gatsby Image

Gatsby has extensive support for remote and local images. In this example, we use the gatsby-image plugin to show image assets from Hygraph right inside of our Gatsby pages.

This example uses the gatsby-source-grahcms plugin to source data.

Gatsby with MDX

MDX is Markdown for the component era. It gives you the ability to render React components (or JSX as it's known) within your Markdown.

Since Hygraph supports the Markdown field, we can invoke it and let Gatsby + MDX render these inside of our pages.

Hygraph React Image

Those who are working with React and looking for a way to render images with optimized lazy loading and “blur up” out of the box should consider adding @hygraph/react-image to your application.

This example uses our example Hygraph project for products, and shows product images on a page.

GraphQL Code Generator

Writing types for all of your GraphQL queries by hand is time consuming. Thankfully the GraphQL Code Generator can take care of this and more.

This example demonstrates how to automatically generate code for Apollo Client and TypeScript.

GraphQL Mesh

GraphQL Mesh is a popular project that lets you query data from anywhere. It automatically builds a GraphQL API for any specification you throw at it. Whether it be a Mongoose model, or a OpenAPI spec, you’ll get a fully functional GraphQL API with transport taken care of.

In this example, we use GraphQL Mesh to stitch the Hygraph schema with 2 other GraphQL APIs. You can then query GraphQL Mesh directly or using the SDK (with baked in GraphQL Code Generator).

Gridsome

The popular Jamstack framework for Vue.js “Gridsome” works with Hygraph via the GraphQL plugin. Similar to Gatsby, Gridsome is a Static Site Generator that works with plugins to compile a static output on deployment, giving users a blazing fast experience when navigating your site.

In this example, we’ll query for some products and a product by slug on its own page.

Next.js

React continues to dominate the JavaScript ecosystem for front-end framework options. Next.js is an excellent minimalist framework for React that gives you all of the tools to build static, and dynamic sites.

If you’re used to building with a full stack framework, Next.js combined with Hygraph offers a similar experience. In this example, Hygraph will take care of the backend, and Next.js will take care of creating static pages for all products and individual product pages, all of which rebuild on-demand after a period of time.

Next.js with MDX

Similar to the example with Gatsby, here we’ll use Next.js and the packages next-mdx-remote & he to build MDX nodes from Hygraph to render in your Next.js application.

In this example, we’ll render our product pages and show a custom <Test /> component inside of the product description on the product display page.

Next.js Internationalized Routing

Next.js features built-in internationalized routing capabilities that can work with Hygraph localizations. This example shows how we can have products in several locales inside of Hygraph and configure them with Next.js to use the same locales

We can prefix routes for our products and show the applicable localized content.

Next.js Image

The next/image component is a popular choice for Next.js developers to render images that are sourced locally or in our case, remotely.

This component enables improved performance, visual stability, faster page loads, and much more.

In this example, we’ll render some product images using the Next.js image component.

Next.js Image with custom loader

Similar to the Next.js Image component above to render images, in this example we’ll use the Hygraph Asset CDN to deliver images. This gives us the ability to use Hygraph asset transformations, instead of relying on Next.js to do it.

Nuxt.js

Similar to React, Vue has its fair share of frontend frameworks to help organize, and structure well written apps. In this example, we’ll use our example products Hygraph project to automatically list out all products, and our single product pages using the Nuxt.js routing conventions.

Create React App

If you’ve been working with React long enough you’ll remember when Dan first introduced us to Create React App, removing all of the configuration, and giving us some strong React conventions to follow.

In this example we’ll do the same as what we’ve done previously, but this time load data on the client, similar to how we do with Apollo Client, and render it with React.

Vue.js

Similar to what we did with Create React App, we’ll use the native Vue primitives to build an app that can serve products on a single page, as well as individual pages with some built-in routing support.

In this example, we bind a Hygraph instance of graphql-request as a mixin inside of our app. We can then use this to make any queries by hooking into Vue on each of our routes.

SvelteKit

The increasingly popular Svelte application framework SvelteKit is great if you want to build apps with a smaller footprint.

In this example, we’ll create an instance of graphql-request and use this to query Hygraph on the server inside of the load hooks provided by SvelteKit.

SvelteKit with URQL

The dependency we used above with the graphql-request example is very barebones. Here we use a powerful GraphQL Client, “URQL” to handle communication between our app, and Hygraph.

SvelteKit with Houdini

Simply install the Houdini plugin with your Svelte application, and instantly see results when working with GraphQL thanks to its impressive fast compiler, and type generation support.

If you like working with GraphQL Code Generator, and having the type safety when building Svelte apps, Houdini is a great alternative.

Eleventy

Eleventy promises a simpler Static Site Generator. If you’re used to working with traditional, battle tested template languages and need to source GraphQL data for your pages, this example shows how you can do that.

Astro

Astro is another static site builder built for the modern web, priding itself on powerful developer experience and less JavaScript output builds.

In this example, we’ll use our Hygraph project for sourcing products and fetch them inside of an Astro build using native fetch.

Vanilla JS

If you have been around long enough before the frontend framework wars, you’ll remember what it was like to ship JavaScript you write (and minify if you’re lucky) to the browser.

In this example, we’ll fetch a list of products inside of the browser using the native fetch API.

NextAuth.js

Using the Hygraph Mutations API, and combined with the Mutations example above, we can build a user facing app with Next.js + NextAuth.js that allows users to register and login using Hygraph as a database.

#Contributing

There are over a dozen examples and growing. If you don’t see something you’re looking for, let us know, and if you’re working with any Hygraph features, or tools not listed above, you can contribute to this list by opening a Pull Request on GitHub.

Blog Author

Jamie Barton

Jamie Barton

Jamie is a software engineer turned developer advocate. Born and bred in North East England, he loves learning and teaching others through video and written tutorials. Jamie currently publishes Weekly GraphQL Screencasts.

Share with others

Sign up for our newsletter!

Be the first to know about releases and industry news and insights.