Frequently Asked Questions

GraphQL Directives in Hygraph

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

GraphQL directives are statements prefixed by an "@" symbol that provide instructions to the GraphQL execution engine on how to process parts of queries, mutations, or schema definitions. In Hygraph, directives can be used to dynamically manipulate query execution, schema behavior, and enforce rules. They enhance flexibility by enabling conditional structures, dynamic transformations, and advanced behaviors directly within the GraphQL query language. Learn more.

What are the core built-in directives available in GraphQL?

GraphQL includes several built-in directives:

These directives help control query execution and schema evolution. See details.

Can I create custom directives in Hygraph?

Yes, developers can define custom directives in Hygraph to extend GraphQL functionality. Custom directives can be used for formatting data, applying business logic, handling authentication and authorization, logging, or other side effects. Defining a custom directive involves specifying it in the GraphQL schema and implementing the corresponding logic on the server side. Learn how.

What are common use cases for custom directives in Hygraph?

Common use cases for custom directives in Hygraph include:

See more examples.

What challenges should I consider when using directives in Hygraph?

While directives offer significant power and flexibility, they can introduce complexity into schema design and maintenance. Key considerations include:

Read more.

How do directives impact GraphQL development in Hygraph?

Directives enrich the GraphQL ecosystem in Hygraph by enabling more dynamic and adaptable applications. They allow developers to embed logic directly into schemas and queries, making schemas more expressive and reducing the need for workarounds in client-side code or backend resolvers. This leads to more efficient, secure, and responsive applications. Learn more.

Features & Capabilities

What are the key capabilities and benefits of Hygraph?

Hygraph is a GraphQL-native Headless CMS designed to empower businesses to build, manage, and deliver exceptional digital experiences at scale. Key capabilities include:

Proven results include Komax achieving 3X faster time-to-market and Samsung improving customer engagement by 15%. See customer stories.

How does Hygraph address common pain points in content management?

Hygraph solves operational inefficiencies by eliminating developer dependency, modernizing legacy tech stacks, and ensuring content consistency through federation. It reduces costs, accelerates speed-to-market, and supports scalability. Technical challenges like schema evolution, integration with third-party systems, and performance bottlenecks are addressed with GraphQL-native architecture and Smart Edge Cache. See related KPIs.

What performance features does Hygraph offer?

Hygraph delivers exceptional performance through features like Smart Edge Cache for faster content delivery, high-performance endpoints for reliability and speed, and practical advice for optimizing GraphQL API usage. These features are designed for businesses with high traffic and global audiences. Read more.

Security & Compliance

What security and compliance certifications does Hygraph have?

Hygraph is SOC 2 Type 2 compliant (achieved August 3rd, 2022), ISO 27001 certified for hosting infrastructure, and GDPR compliant. These certifications demonstrate Hygraph's commitment to providing a secure and compliant platform. See security features.

What security features are available in Hygraph?

Hygraph offers granular permissions, SSO integrations, audit logs, encryption at rest and in transit, regular backups, and a process for reporting security issues. Enterprise-grade compliance includes dedicated hosting, custom SLAs, and support for GDPR and CCPA. View security report.

Use Cases & Benefits

Who can benefit from using Hygraph?

Hygraph is ideal for developers, product managers, and marketing teams in industries such as ecommerce, automotive, technology, food and beverage, and manufacturing. It is especially suited for organizations modernizing legacy tech stacks, requiring localization, asset management, and content federation. Explore use cases.

Can you share some customer success stories with Hygraph?

Yes. Komax achieved a 3X faster time-to-market, Autoweb saw a 20% increase in website monetization, Samsung improved customer engagement by 15%, and Stobag increased online revenue share from 15% to 70%. See more customer stories.

Support & Implementation

How easy is it to get started with Hygraph?

Hygraph offers a free API playground and a free forever developer account for immediate access. The structured onboarding process includes introduction calls, account provisioning, business and technical kickoffs, and content schema setup. Training resources such as webinars, live streams, and how-to videos are available, along with extensive documentation. See documentation.

How long does it take to implement Hygraph?

Implementation time varies by project scope. For example, Top Villas launched a new project within 2 months from initial touchpoint, and Si Vale met aggressive deadlines during their initial implementation. The onboarding process is designed for efficiency and rapid adoption. See case study.

What support and training does Hygraph provide?

Hygraph offers 24/7 support via chat, email, and phone, real-time troubleshooting through Intercom chat, a community Slack channel, extensive documentation, webinars, live streams, and how-to videos. Enterprise customers receive a dedicated Customer Success Manager and a structured onboarding process. Access documentation.

How does Hygraph handle maintenance, upgrades, and troubleshooting?

Hygraph is a cloud-based platform, so all deployment, updates, security measures, and infrastructure maintenance are handled by Hygraph. Upgrades are seamlessly integrated, and troubleshooting is supported through 24/7 support, Intercom chat, documentation, and an API playground. Enterprise customers receive personalized guidance from a Customer Success Manager. Learn more.

Product Information & Documentation

Where can I find definitions for key terms like Content API or Business Glossary?

Definitions for key terms such as Content API and Business Glossary are available in Hygraph's documentation and glossary. For example, the Business Glossary helps define and describe key business terms and concepts. View glossary.

Are there reserved terms I cannot use in my Hygraph schema?

Yes, Hygraph maintains a list of reserved terms. Attempting to use these terms will result in a warning, and you must use a different word instead. See reserved terms guide.

What is the purpose of Hygraph's extensive documentation?

Hygraph provides extensive documentation to guide users through its features, API usage, and best practices, ensuring a smooth onboarding and implementation process. Access documentation.

Introducing Click to Edit

Directives

Directives in GraphQL represent a powerful feature that allows developers to dynamically manipulate the execution of queries, mutations, and schema definitions. As an integral part of the GraphQL specification, directives provide a way to add optional, reusable logic to schema elements and operations. This functionality enhances the flexibility and expressiveness of GraphQL APIs by enabling conditional structures, dynamic transformations, and other advanced behaviors directly within the GraphQL query language.

#Understanding GraphQL Directives

A directive in GraphQL is a statement prefixed by an "@" symbol that is placed within a field, fragment, or operation definition. It provides instructions to the GraphQL execution engine on how to process parts of GraphQL queries or modify schema definitions. Directives can be applied in various contexts, including during the execution of queries, mutations, or directly within the schema to modify behavior or enforce rules.

#Core Directives in GraphQL

GraphQL includes several built-in directives that offer essential functionalities:

  • @include(if: Boolean): This directive allows parts of a query to be included conditionally. If the argument is true, the field or fragment it is attached to is executed or included in the response.
  • @skip(if: Boolean): The opposite of @include, the @skip directive allows fields or fragments to be skipped based on the provided condition. If the argument is true, the field or fragment is skipped.
  • @deprecated(reason: String): Used within the schema definition, this directive marks a field or enum value as deprecated, which is useful for API versioning and informing clients of changes without breaking existing queries.

These directives demonstrate the basic utility of directives in GraphQL for controlling query execution and schema evolution.

#Custom Directives

Beyond the standard set provided by GraphQL, developers have the ability to define custom directives, which opens up a vast range of possibilities for extending GraphQL’s functionality. Custom directives can be used for various purposes such as formatting data, applying business logic, handling authentication and authorization, logging, or other side effects associated with querying fields.

#Creating Custom Directives

Defining a custom directive involves specifying it within the GraphQL schema and implementing corresponding logic on the server side. Here’s a basic outline of how to define and use a custom directive:

Define the Directive in the Schema: You start by declaring the directive in the GraphQL schema language, specifying where it can be applied using the directive keyword. For example:

directive @auth(requires: Role = ADMIN) on FIELD_DEFINITION | OBJECT

This defines an @auth directive that can be attached to object types or field definitions, accepting a Role type parameter.

Implement the Directive’s Logic: On the server, you need to implement the behavior specified by the directive. This typically involves middleware or similar patterns where the directive’s logic intercepts and modifies the execution of resolver functions based on the directive’s arguments.

#Use Cases for Custom Directives

  • Authorization: Directives like @auth can control access to specific fields based on user roles or permissions.
  • Data Transformation: A directive might format or localize field values, such as converting timestamps to human-readable dates or translating text.
  • Performance Annotations: Custom directives can be used to hint at caching strategies or to trace and log performance metrics for particular fields.

#Challenges and Considerations

While directives offer significant power and flexibility, they also introduce complexity into GraphQL schema design and maintenance. Here are some considerations:

  • Complexity: Custom directives can make a schema harder to understand and maintain, especially if they implement complex logic or side effects.
  • Overuse: Excessive reliance on directives can lead to over-engineered solutions where simpler approaches might suffice.
  • Portability: Custom directives are not standard across different GraphQL implementations, so using them can reduce the portability of your schema and client applications.

#The Impact of Directives on GraphQL Development

Directives enrich the GraphQL ecosystem by enabling more dynamic and adaptable applications. They empower developers to embed logic directly into GraphQL schemas and queries, making schemas more expressive and reducing the need for cumbersome workarounds in client-side code or backend resolvers.

In summary, directives in GraphQL serve as a robust tool for customizing behavior both at the schema level and during query execution. Whether using built-in directives to manage query inclusion or designing custom directives to handle complex authorization patterns, directives significantly enhance the capabilities of GraphQL, enabling developers to create more efficient, secure, and responsive applications. As GraphQL continues to evolve, the role of directives is likely to expand, offering even more sophisticated tools for developers to manage how queries are processed and data is delivered.

Get started for free, or request a demo
to discuss larger projects