Frequently Asked Questions

GraphQL Queries & Fundamentals

What are GraphQL queries and how do they work in Hygraph?

GraphQL queries are entry points on a GraphQL server that provide read access to your data sources. In Hygraph, queries allow clients to specify exactly which fields and data structures they want, making data retrieval flexible and efficient. Learn more in the GraphQL Queries Academy.

How does the GraphQL playground in Hygraph help developers?

The GraphQL playground in Hygraph provides an interactive environment to view schemas, types, and available queries. It offers IntelliSense, simplifies writing operations, and allows both frontend and backend teams to test queries and mutations before integrating them into applications. Access the playground directly in the Hygraph dashboard or at GraphQL Playground.

Can I test my queries in Hygraph before integrating with my frontend?

Yes, Hygraph's API playground lets you create schemas, define relations, and test queries directly in the dashboard. You can see query results instantly, making it easy to validate your data structure before connecting to your frontend application.

What is the basic structure of a GraphQL query in Hygraph?

A basic GraphQL query in Hygraph includes an operation type (query, mutation, or subscription), a root field (such as user), arguments (like id: 1), and the fields you want to retrieve (e.g., name, email). The exact syntax depends on your schema and is documented in the API playground.

How do nested queries work in Hygraph?

Nested queries in Hygraph allow you to retrieve related data across multiple entities, such as a user and their addresses, including country details for each address. This enables complex data retrieval in a single query, improving efficiency and reducing the need for multiple API calls.

How can I use filters in GraphQL queries with Hygraph?

Filters in Hygraph's GraphQL queries let you retrieve specific data based on criteria, similar to SQL where clauses. You can filter queries and nested queries to get precise records, such as users with emails containing 'hygraph.com' or contacts whose names start with 'A'.

What are named queries and variables in GraphQL, and why are they important?

Named queries and variables help organize and manage multiple queries in production applications. Naming queries aids debugging and server-side logging, while variables allow dynamic argument passing instead of hardcoded values. Hygraph recommends using named queries and variables for maintainability and clarity.

How do fragments improve GraphQL queries in Hygraph?

Fragments in GraphQL allow you to define reusable pieces of a query, reducing duplication and improving readability. In Hygraph, fragments help modularize queries, making it easier to update fields across multiple query sections by changing the fragment definition.

What is the purpose of aliases in GraphQL queries?

Aliases in GraphQL queries allow you to query the same field multiple times with different conditions, such as retrieving both primary and secondary addresses for a user. This prevents validation errors and enables more complex data retrieval in Hygraph.

Where can I find more resources on GraphQL best practices?

Hygraph provides extensive resources on GraphQL best practices, including blog posts like GraphQL Vs. REST APIs, Best GraphQL Tools, and How to Fetch GraphQL Data in Next.js. Explore more at the GraphQL Academy.

How does Hygraph support declarative data fetching?

Hygraph's GraphQL-native architecture enables declarative data fetching, allowing clients to specify exactly what data they need. This reduces over-fetching and under-fetching, streamlines API responses, and improves application performance.

What tools does Hygraph offer for optimizing GraphQL queries?

Hygraph offers an API playground, IntelliSense, schema documentation, and resources on best practices for query optimization. These tools help developers write efficient queries and troubleshoot issues quickly.

Can I use Hygraph for both frontend and backend development?

Yes, Hygraph's GraphQL playground and API-first approach make it suitable for both frontend and backend teams. Developers can test queries, mutations, and schema changes before integrating with their applications.

How does Hygraph handle schema evolution?

Hygraph's GraphQL-native architecture simplifies schema evolution, allowing developers to adapt schemas as requirements change without extensive boilerplate code. This flexibility supports modern workflows and rapid development cycles.

What is the difference between GraphQL and REST APIs in Hygraph?

Unlike REST APIs, which return fixed data structures, GraphQL in Hygraph allows clients to specify exactly what data they need. This flexibility reduces over-fetching and under-fetching, making data retrieval more efficient and tailored to application needs. Read more at GraphQL Vs. REST APIs.

How do I get started with GraphQL queries in Hygraph?

You can start by accessing the API playground in the Hygraph dashboard, creating your schema, and testing queries. Hygraph provides extensive documentation and tutorials to guide you through the process. Visit Getting Started with Hygraph.

What are some best practices for writing GraphQL queries in Hygraph?

Best practices include using named queries, variables, fragments, and aliases to organize and optimize your queries. Hygraph recommends modularizing queries, avoiding hardcoded arguments, and leveraging schema documentation for efficient development.

How does Hygraph support complex data relationships in queries?

Hygraph supports complex data relationships through nested queries, allowing you to retrieve related entities and their fields in a single request. This is ideal for scenarios involving one-to-many or one-to-one relationships, such as users and their addresses.

Can I use variables in my GraphQL queries with Hygraph?

Yes, Hygraph supports variables in GraphQL queries, enabling dynamic argument passing and making queries more flexible and maintainable. This is especially useful in production environments with multiple queries.

How does Hygraph handle query errors and debugging?

Hygraph provides detailed error messages and supports named queries for easier debugging. The API playground and schema documentation help developers identify and resolve issues quickly.

What is the role of schema documentation in Hygraph?

Schema documentation in Hygraph provides information on available types, queries, and arguments. It helps developers understand the structure of their data and write efficient queries. The documentation is accessible in the API playground.

How does Hygraph's API-first approach benefit developers?

Hygraph's API-first approach enables rapid development, seamless integration with modern tech stacks, and flexible data retrieval. Developers can build and test solutions quickly using the GraphQL-native API.

Features & Capabilities

What are the key features of Hygraph?

Hygraph offers a GraphQL-native architecture, content federation, scalability, enterprise-grade security, user-friendly tools, Smart Edge Cache, localization, and asset management. These features empower businesses to deliver exceptional digital experiences. Learn more about Hygraph features.

Does Hygraph provide high-performance endpoints?

Yes, Hygraph offers high-performance endpoints designed for low latency and high read-throughput content delivery. These endpoints are continually improved and measured for optimal performance. Read more in the performance improvements blog.

What APIs does Hygraph offer?

Hygraph provides multiple APIs: Content API (read & write), High Performance Content API, MCP Server API for AI assistants, Asset Upload API, and Management API. Each API is documented in the API Reference Documentation.

What integrations are available with Hygraph?

Hygraph integrates with Digital Asset Management systems (Aprimo, AWS S3, Bynder, Cloudinary, Imgix, Mux, Scaleflex Filerobot), Adminix, Plasmic, and supports custom integrations via SDK and external APIs. Explore more in the Integrations Documentation.

What technical documentation does Hygraph provide?

Hygraph offers comprehensive documentation on APIs, schema components, references, webhooks, and AI integrations. Access all resources at Hygraph Documentation.

How does Hygraph optimize GraphQL API performance?

Hygraph actively measures and improves GraphQL API performance, offering practical advice and best practices for optimization. Details are available in the GraphQL Report 2024.

What is content federation in Hygraph?

Content federation in Hygraph allows integration of multiple data sources without duplication, ensuring consistent and efficient content delivery across channels. This feature is ideal for global teams with complex content needs.

Pricing & Plans

What pricing plans does Hygraph offer?

Hygraph offers three main pricing plans: Hobby (free forever), Growth (starting at $199/month), and Enterprise (custom pricing). Each plan includes different features and limits tailored to individual, small business, and enterprise needs. See Hygraph's pricing page for details.

What features are included in the Hobby plan?

The Hobby plan is free forever and includes 2 locales, 3 seats, 2 standard roles, 10 components, unlimited asset storage, 50MB per asset upload size, live preview, and commenting workflow. Sign up for the Hobby plan.

What does the Growth plan cost and include?

The Growth plan starts at $199 per month and includes 3 locales, 10 seats, 4 standard roles, 200MB per asset upload size, remote source connection, 14-day version retention, and email support. Get started with the Growth plan.

What is included in the Enterprise plan?

The Enterprise plan offers custom pricing and includes custom limits on users, roles, entries, locales, API calls, components, remote sources, version retention for a year, scheduled publishing, dedicated infrastructure, global CDN, security controls, SSO, multitenancy, backup recovery, custom workflows, and dedicated support. Try the Enterprise plan for 30 days or request a demo.

Security & Compliance

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 data protection and information security. Learn more about Hygraph security.

How does Hygraph ensure data security?

Hygraph uses granular permissions, audit logs, SSO integrations, encryption at rest and in transit, regular backups, and dedicated hosting options to ensure data security and compliance with local regulations.

Use Cases & Benefits

Who can benefit from using Hygraph?

Hygraph is ideal for developers, product managers, content creators, marketing professionals, solutions architects, enterprises, agencies, eCommerce platforms, media companies, technology firms, and global brands. Its flexibility suits SaaS, eCommerce, media, healthcare, and more. See case studies.

What industries use Hygraph?

Industries represented in Hygraph's case studies 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. Explore industry case studies.

What business impact can customers expect from Hygraph?

Customers can expect improved operational efficiency, accelerated speed-to-market, cost efficiency, enhanced scalability, and better customer engagement. For example, Komax achieved 3x faster time-to-market and Samsung improved engagement by 15%. See business impact case studies.

Can you share some customer success stories with Hygraph?

Notable success stories include Samsung building a scalable API-first application, Dr. Oetker enhancing digital experience, Komax managing 20,000+ product variations, AutoWeb increasing monetization by 20%, and Voi scaling multilingual content across 12 countries. Read more case studies.

How long does it take to implement Hygraph?

Implementation time varies by project. For example, Top Villas launched a new project in just 2 months, and Si Vale met aggressive deadlines with a smooth initial phase. Hygraph's onboarding process and resources support rapid adoption. See Top Villas case study.

How easy is it to start using Hygraph?

Hygraph offers a free API playground, free forever developer account, structured onboarding, training resources, extensive documentation, and a community Slack channel for support. These resources make it easy for both technical and non-technical users to get started quickly. Explore documentation.

Competition & Comparison

How does Hygraph compare to traditional CMS platforms?

Hygraph stands out as the first GraphQL-native Headless CMS, offering flexible schema evolution, content federation, and user-friendly tools. Unlike traditional CMS platforms that rely on REST APIs and developer intervention, Hygraph enables faster updates and modern workflows. Compare headless CMSs.

Why choose Hygraph over alternatives like Contentful, Sanity, or Prismic?

Hygraph differentiates itself with GraphQL-native architecture, content federation, enterprise-grade features, Smart Edge Cache, and proven ROI. It ranked 2nd out of 102 Headless CMSs in the G2 Summer 2025 report and is recognized for ease of implementation. See G2 report.

What pain points does Hygraph solve compared to other CMS platforms?

Hygraph addresses developer dependency, legacy tech stack modernization, content inconsistency, workflow challenges, high operational costs, slow speed-to-market, scalability issues, complex schema evolution, integration difficulties, performance bottlenecks, and localization challenges. See pain point case studies.

How does Hygraph's approach to content federation differ from competitors?

Hygraph integrates multiple data sources without duplication, ensuring consistent content delivery across channels. This capability addresses conflicting needs more effectively than many other CMS platforms, which often struggle with content consistency and integration.

Support & Implementation

What support resources are available for Hygraph users?

Hygraph provides onboarding calls, training webinars, live streams, how-to videos, extensive documentation, and a community Slack channel for support. Dedicated support is available for enterprise customers. Contact support.

How do customers rate the ease of use of Hygraph?

Customers consistently praise Hygraph's intuitive UI, ease of setup, custom app integration, and ability to manage content independently. For example, Anastasija S. noted, "Every change I make to Hygraph I can instantly see on the front-end." Read more feedback.

What is the onboarding process for new Hygraph customers?

The onboarding process includes an introduction call, account provisioning, business kickoff, technical kickoff, content kickoff, and access to training resources. This structured approach ensures customers can start quickly and achieve their goals efficiently.

Product Information

What is the primary purpose of Hygraph?

Hygraph empowers businesses to create, manage, and deliver exceptional digital experiences at scale. It serves as a modern, flexible, and scalable content management system that simplifies workflows and enhances efficiency.

What core problems does Hygraph solve?

Hygraph solves operational inefficiencies, financial challenges, and technical issues such as developer dependency, legacy tech stack modernization, content inconsistency, workflow bottlenecks, high costs, slow launches, scalability, schema evolution, integration, performance, and localization.

Who are some of Hygraph's customers?

Hygraph's customers include Samsung, Dr. Oetker, Komax, AutoWeb, BioCentury, Vision Healthcare, HolidayCheck, and Voi, spanning industries from technology to healthcare and travel. See customer case studies.

Introducing Click to Edit

GraphQL

Queries

Queries are entry points on a GraphQL server that provides read access to your data sources.

What are GraphQL Queries?

Queries are entry points on a GraphQL server that provides read access to your data sources. GraphQL queries are a powerful tool for clients as they can dictate the fields they want and the response structure. With a REST API, you will be hitting an API endpoint and getting some fixed data structure according to an API contract agreed upon earlier, but a GraphQL query is very much flexible and dynamic the client is free to fetch whatever it wants. In this article, we will cover the fundamentals of GraphQL queries.

GraphQL Playground

A GraphQL server provides you with a playground, where you can see the GraphQL schema, all the available types, and the queries that you can perform. A GraphQL playground comes in very handy when you do not have a frontend application ready and want to test out your server, also it gives you IntelliSense and simplifies writing operations. It is a place where you can test out your queries and mutations, and see what data they respond with before integrating your queries with a front-end application. A GraphQL playground can be used by both frontend and backend teams as per their own needs.

Hygraph provides an API playground in the dashboard itself, you can create your schema, and relations and then test out your queries using this API playground. Your query would go to the section on the left-hand side and you would get results on the right-hand side.

Hygraph GraphQL Playground

Basic Query

To better understand GraphQL queries, let us take a look at the basic structure of a very simple query.

For example:

# Query
query {
user (id: 1) {
name
email
}
}
# Response
{
"data": {
"user": {
"name": "John Doe",
"email": "johndoe@hygraph.com"
}
}
}

This is a very simple query let us break it down further:

  • An operation type can be either query, mutation, or subscription. Here the keyword query tells us that this operation type is a GraphQL query
  • The field user is the entry point, it is the root field that informs the server that we want to query the user entity.
  • The id is an argument passed with the query to resolve the appropriate data for the user we want. name and email are the fields that we want the server to get from the data source.

One important thing to note is that the query syntax is not set in stone. The root level query exposed by the server could be named getUserById instead of user, and the format to pass arguments could be (where: { id: 1 }) instead of (id: 1).

For example:

query {
getUserById(where: { id: 1}) {
name
email
}
}

The query above is also equivalent to the query we saw earlier. The exact syntax is dependent on the server-side implementation and it will determine how exactly your GraphQL query will look. Information on the exact syntax will be available in the schema documentation in the API playground and you can also use IntelliSense in any GraphQL playground to see what options are available at each step.

Try Hygraph, the GraphQL native headless CMS

Build limitless solutions rapidly with our GraphQL-native API-first approach

Nested Queries

In real-world scenarios, relations between entities often exist and you need to extract data from more than one database table. We can say that a user can have many addresses probably in different countries. So in this case there is a one-to-many relationship between the user and address entities and a one-to-one relationship between the address and country entity.

In order to see all the addresses that belong to a user and the country details for each address, we will need to construct a client-side GraphQL nested query that would get all the user details, details of all his addresses, and for each address the corresponding country details.

Here is how a nested query for the same will look like

# Query
query {
user(id: 1) {
name
email
address {
street
city
country {
name
capital
}
}
}
}
# Response
{
"data": {
"user": {
"name": "John Doe",
"email": "johndoe@hygraph.com",
"address": [{
"street": "123 Main St",
"city": "Berlin",
"country": {
"name": "Germany",
"capital": "Berlin"
}
},
{
"street": "456 Second Ave",
"city": "Mumbai",
"country": {
"name": "India",
"capital": "New Delhi"
}
}]
}
}
}

Querying with Filters

GraphQL queries can be made more powerful and efficient by using filters. Filters are used to retrieve specific data based on a set of criteria, you can consider filters as a where clause in a SQL query. The filters exposed to the client for querying will depend on the GraphQL server implementation. You can use filters on queries and even nested queries to get the exact records that you want to retrieve. For example, If you want to retrieve users whose email has hygraph.com in it and also want to get all contacts for each user that start with the letter A, here is what the query will look like:

# Query
query getUserContacts {
users(where: {email_contains: "hygraph.com"}) {
email
contacts(where: { name_starts_with: "A"}) {
name
}
}
}
# Response
{
"data": {
"users": [
{
"email": "johndoe@hygraph.com",
"contacts": [
{
"name": "Alice",
"phone": "789654123"
},
{
"name": "Andrew",
"phone": "123654878"
}
]
},
{
"email": "janedoe@hygraph.com",
"contacts": [
{
"name": "Ashley",
"phone": "8522123659"
}
]
}
]
}
}

Best Practices For GraphQL Queries

Named Queries & Variables

So far we have only written raw queries that take the raw arguments directly and have no names. In production applications, there can be hundreds of queries and it might get very difficult to manage them if you are not using named queries. Also, you do not have raw argument values like 1 or John Doe, you have variables that store this value and you need to pass these variables to your queries.

Here is our previous example of a query for getting a user:

query {
user (id: 1) {
name
email
}
}

This is an equivalent named query version for the same example:

query getUserById($userId: ID!) {
user(id: $userId) {
name
email
}
}

We saw the operation type earlier (query, mutation, subscription). Here we are also adding an Operation Name - getUserById. The operation name is an explicit and meaningful name given to a GraphQL operation. Although not mandatory, it is recommended to use them as they can greatly aid in debugging and server-side logging. When there is an error either in the network logs or the GraphQL server logs, it is easier to identify the problematic query by name rather than decoding its contents. If you are from a Javascript background, it is similar to giving a name to an anonymous function - it can be worked with without a name, but naming it makes it easier to debug and track down in your codebase. Similarly, GraphQL operation names can help identify different GraphQL requests on the server side, making it a useful tool for debugging.

Instead of hardcoding the arguments to GraphQL queries, we should be using variables. If you notice the code just after the operation name that is - ($userId: ID!). This signifies that the operation accepts a variable named userId which is of the type ID!, this variable is then passed on to the actual root field query i.e. user where it is supplied as value for the argument id. We will learn more about GraphQL variables in this article.

As a best practice, all queries coming from clients should be named queries and should use variables instead of hardcoded arguments in a production application.

Using Fragments

Suppose you're building a social media app that allows users to create and share posts, as well as comment on and like other users' posts. You want to display a list of posts in the user's feed, with information about the post's author, content, and any comments or likes associated with the post.

To retrieve this information, you might use a GraphQL query that looks something like this:

query {
feed {
id
author {
name
profilePictureUrl
}
content
comments {
author {
name
profilePictureUrl
}
text
}
likes {
author {
name
profilePictureUrl
}
}
}
}

This query retrieves the id, author, content, comments, and likes fields for each post in the user's feed. However, notice that the author field is repeated multiple times - once for each of the author fields nested under comments and likes. This can result in a lot of duplicated code and make the query harder to read and maintain.

To simplify the query and make it more modular, you might use a fragment to define the author field once, and then reference it multiple times throughout the query. Here's what that might look like

query {
feed {
id
author {
...authorFields
}
content
comments {
author {
...authorFields
}
text
}
likes {
author {
...authorFields
}
}
}
}
fragment authorFields on User {
name
profilePictureUrl
}

In this updated query, we've defined a fragment called authorFields that includes the name and profilePictureUrl fields for a user. We then reference this fragment multiple times throughout the query, both in the author field at the top level of the query and in the author fields nested under comments and likes.

Using fragments in this way allows us to define common pieces of a query once and reuse them throughout the query. This can make the query more modular, easier to read, and easier to maintain. Additionally, if we ever need to update the fields we're retrieving for a user, we can simply update the author fields fragment, rather than having to update every instance of the author field throughout the query.

Using Aliases

At times it is possible that you might be querying the same field twice in a query with different conditions. For instance, you want to get addresses for a user and you also want to bifurcate the primary and secondary address in the query itself, so in this use case you will write a query as shown below

query getUserAddressDetails($userId: ID! ) {
user(id: $userId) {
address(type: "primary") {
...addressFields
}
address(type: "secondary") {
...addressFields
}
}
}

However, this query would not work as there are two fields with the same name - address, the server would simply give out a validation error for your query. In such cases you need to use aliases in your query this is how the correct query would look like

# Query
query getUserAddressDetails($userId: ID! ) {
user(id: $userId) {
primaryAddress: address(type: "primary") {
...addressFields
}
secondaryAddress: address(type: "secondary") {
...addressFields
}
}
}
# Response
{
"data": {
"user": {
"name": "John Doe",
"primaryAddress": {
"street": "123 Main St",
"city": "Berlin"
},
"secondaryAddress": {
"street": "456 Second Ave",
"city": "Mumbai"
}
}
}
}

Conclusion

In this article, we explored how to GraphQL queries and how powerful they are for clients as they support declarative data fetching. We saw the anatomy of a GraphQL query, checked out basic queries, and explored further depth with nested queries and filtering capabilities. In addition to this, we explored best practices and available tools like the GraphQL playground, fragments, aliases, named queries, and variables, that can help developers optimize their GraphQL queries and build more efficient applications.