Frequently Asked Questions

Technical Setup & Usage

What is the Hygraph JavaScript SDK and what can I use it for?

The Hygraph JavaScript SDK enables you to build UI Extensions using native JavaScript or your preferred framework and bundler. It allows you to interact with Hygraph data, synchronize custom input fields, and extend the Hygraph editor with custom functionality. For React projects, Hygraph recommends using the React SDK instead.

How do I set up the Hygraph JavaScript SDK in my project?

You can include the UI Extensions SDK in your project either by adding the script tag to the head of your HTML file via CDN or by installing it as an npm package. For CDN setup, you must also include Hygraph's patched version of Zoid before the SDK. For npm, run npm install @graphcms/uix-sdk. After setup, create an extension declaration to define your custom extension.

How do I interact with Hygraph data using the JavaScript SDK?

Once the SDK is initialized, you can read data from Hygraph, subscribe to value changes, and update values from within your extension. By providing an onProps callback at initialization, you can synchronize your custom input fields with Hygraph and ensure all changes are reflected in real time.

Can I use the Hygraph JavaScript SDK with TypeScript?

Yes, the JavaScript SDK is written in TypeScript and can be used in TypeScript projects. You can validate the shape of your extension declaration object and leverage TypeScript's type safety for props and configuration.

What is an Extension Declaration for a Hygraph UI Extension?

An Extension Declaration is an object that describes the extension, its capabilities, and its configuration options. It is required to define the type of extension (e.g., field, sidebar), the field type, name, description, and features. For more details, see the official documentation.

Features & Capabilities

What are Hygraph UI Extensions and what do they enable?

Hygraph UI Extensions allow you to extend the functionality of the Hygraph Web App with custom applications. They enable teams to interact with content stored externally, ensure content consistency, and build custom UI elements in the editor and contextual sidebar. For more, see the UI Extensions announcement.

What are the benefits of using UI Extensions and Remote Fields in Hygraph?

UI Extensions and Remote Fields allow teams to always have the most up-to-date information and build content pages that reflect the most current offerings. They help ensure content consistency and enable interaction with external data sources. For example, Top Villas uses UI Extensions to keep content synchronized and consistent across platforms (Top Villas Case Study).

What is the recommendation for users currently using UI Extensions?

If you are using UI Extensions today, it is recommended to switch to the new app framework as soon as possible to benefit from the latest features and improvements (Product Roundup Q2 2024).

What upcoming feature allows custom UI elements in the Hygraph editor?

UI Extensions will allow custom UI elements in the editor and contextual sidebar, addressing custom content needs (Hygraph Next Blog).

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. For more details, visit the security features page.

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 features include dedicated hosting, custom SLAs, and support for GDPR and CCPA regulations. See the security and compliance report for certified infrastructure.

Support & Implementation

What support and resources are available for developers using Hygraph UI Extensions?

Hygraph provides extensive documentation, code examples, and developer guides for UI Extensions and SDKs. Real-time support is available via Intercom chat, Slack community, and 24/7 support channels. Enterprise customers receive a dedicated Customer Success Manager (CSM) and structured onboarding. Training resources include webinars, live streams, and how-to videos. See Hygraph Documentation for details.

How easy is it to get started with Hygraph and its JavaScript SDK?

Hygraph is designed for easy onboarding. Developers can start immediately using the free API Playground and free forever developer account. The onboarding process includes introduction calls, account provisioning, and technical/content kickoffs. Extensive documentation and training resources are available for step-by-step guidance. See Hygraph Documentation for more information.

Use Cases & Benefits

Who can benefit from using Hygraph UI Extensions and the JavaScript SDK?

Developers, product managers, and marketing teams in industries such as ecommerce, automotive, technology, food and beverage, and manufacturing can benefit from Hygraph UI Extensions. Organizations seeking to modernize legacy tech stacks, streamline content workflows, and deliver consistent digital experiences across global teams will find Hygraph especially valuable.

What problems do Hygraph UI Extensions and the JavaScript SDK solve?

Hygraph UI Extensions and the JavaScript SDK address operational inefficiencies by enabling non-technical users to update content independently, modernizing legacy tech stacks, and ensuring content consistency across global teams. They also reduce operational costs, accelerate speed-to-market, and simplify integration with third-party systems. Technical challenges such as schema evolution, cache issues, and localization are also addressed.

Can you share a customer success story related to Hygraph UI Extensions?

Top Villas used Hygraph UI Extensions to launch a new project within 2 months, enabling their content team to interact with externally stored content and maintain consistency across platforms. This approach ensured up-to-date information and streamlined content management. Read more in the Top Villas Case Study.

Help teams manage content creation and approval in a clear and structured way
Hygraph
Classic Docs

#JavaScript SDK

The JavaScript SDK allows you to build UI Extensions using native JavaScript, or the framework and bundler of your choice.

#Setup the SDK

You need to include the UI Extensions SDK in your project by either adding the script tag to the head of your HTML file, or importing it from NPM.

Directly in your HTML, via CDN:

<script src="https://www.unpkg.com/@graphcms/zoid/lib/zoid.min.js"></script>
<script src="https://www.unpkg.com/@graphcms/uix-sdk@0.2.7/dist/gcuix.umd.production.min.js"></script>

Or if you use a bundler, as an npm package:

npm install @graphcms/uix-sdk

Next, create an extension declaration. Let's assume you are building a custom input for a String field:

const declaration = {
extensionType: 'field',
fieldType: 'STRING',
name: 'My first custom input',
description: '',
features: ['FieldRenderer'],
};

Finally, initialize the SDK:

#Interact with Hygraph

Now that you have initialized the SDK, you can read data from Hygraph, subscribe to value changes, and change values from within the extension.

Let's continue with the custom string input scenario, and use this simplistic HTML markup for diplayed text field:

<input type="text" id="myCustomInput" />

We now want to synchronise this input with Hygraph. It should display the previously saved value on first load, and all user input should be sent back to Hygraph.

By providing an onProps callback at initialization, you can subscribe to all props changes (values, methods, etc..) that happen after initialization.

// we need a reference to the input element
const myInput = document.getElementById('myCustomInput');
init({
declaration,
onProps: (newProps) => {
// each time Hygraph send new props, we update the displayed value to the new one
const { value } = newProps;
myInput.value = value;
},
}).then((initialState) => {
const { status, props } = initialState;
if (status === 'ok') {
// this will only be called once
const { value, onChange } = props;
// we initialize the input with the previously saved value, or a default one if there is none
myInput.value = value || '';
// each time we change the input value, we notify Hygraph of the change
myInput.addEventListener('change', (e) => onChange(e.target.value));
}
});

#Using TypeScript

The JavaScript SDK is written in TypeScript, and can be used with TypeScript projects.

import {
init,
FieldExtensionDeclaration,
FieldExtensionType,
FieldExtensionFeature,
} from '@graphcms/uix-sdk';
// validate the shape of your declaration object by
const declaration: FieldExtensionDeclaration = {
extensionType: 'field',
fieldType: FieldExtensionType.STRING,
name: 'My first custom input',
description: '',
features: [FieldExtensionFeature.FieldRenderer],
};
// Create a new type from your declaration object.
type MyExactDeclarationType = typeof declaration;
// And give it to the init function, allowing it do dynamically type the props transmitted by Hygraph to reflect your extension configuration.
init<MyExactDeclarationType>({
declaration,
onProps: (newProps) => {
// newProps is now typed
const { value } = newProps;
myInput.value = value;
},
}).then((initialState) => {
const { status, props } = initialState; // initialState is now typed
if (status === 'ok') {
// props is now typed
const { value, onChange } = props;
}
});