What is the Hygraph Management SDK and what can I do with it?
The Hygraph Management SDK is a JavaScript/TypeScript library that allows you to programmatically manage your Hygraph project schema and content models. With the SDK, you can create and update models, fields (simple, relational, union, component), and components, as well as automate schema migrations and batch operations. This enables developers to efficiently manage complex content structures and automate repetitive tasks in Hygraph projects. Source: Management SDK Example
What are the main steps to use the Management SDK in a Hygraph project?
To use the Management SDK, you need to:
Enable API access by obtaining an authentication token and endpoint from your Hygraph project's settings.
Initialize the SDK client with your authToken and endpoint.
Create models (e.g., Page, Author, Book) using createModel.
Add fields to models, including simple fields (string, integer, slug, rich text), relational fields (asset, m-1, m-n), union fields, and component fields.
Optionally, update or remove fields and components as needed.
How do I obtain the authentication token and endpoint required for the Management SDK?
To obtain the authentication token (authToken), go to your Hygraph project, navigate to Project Settings > Permanent Auth Tokens > Token, and create or copy a token with the necessary management permissions. For the endpoint (endpoint), go to Project Settings > Endpoints > High Performance Content API and copy the endpoint URL for the environment you wish to interact with. Source: Management SDK Example
What types of fields and relationships can I create with the Management SDK?
The Management SDK supports creating various field types, including:
Simple fields: string, integer, slug, rich text, date/time, etc.
Union fields: fields that can reference multiple models.
Component fields: reusable components with their own fields.
Component union fields: fields that can reference multiple component types.
It also supports field validations (e.g., regex for emails, range for integers), visibility settings, and embedding models in rich text fields. Source: Management SDK Example
Technical Requirements & Implementation
What programming languages are supported by the Hygraph Management SDK?
The Hygraph Management SDK is designed for use with JavaScript and TypeScript, making it suitable for Node.js and modern web development environments. Source: Management SDK Example
How easy is it to get started with the Management SDK?
Getting started with the Management SDK is straightforward. You can install the SDK via npm, obtain your authentication token and endpoint from your Hygraph project settings, and follow the step-by-step example provided in the documentation. The SDK is designed to be intuitive for developers familiar with JavaScript/TypeScript. Source: Management SDK Example
How long does it take to implement Hygraph and start using the Management SDK?
The implementation time for Hygraph can vary based on project complexity. For example, Top Villas launched a new project within 2 months from the initial touchpoint, and Si Vale met aggressive deadlines during their initial implementation. The Management SDK enables rapid schema setup and automation, further accelerating onboarding. Source: Top Villas Case Study, Si Vale Case Study
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 its hosting infrastructure, and GDPR compliant. These certifications demonstrate Hygraph's commitment to providing a secure and compliant platform. Source: Hygraph Security Features
What security features are available in Hygraph?
Hygraph offers granular permissions, SSO integrations, audit logs, encryption at rest and in transit, regular data backups, and enterprise-grade compliance features. Customers can also access a security and compliance report for certified infrastructure. Source: Hygraph Security Features
Performance & Reliability
How does Hygraph ensure high performance for content management and delivery?
Hygraph delivers exceptional performance through features like Smart Edge Cache for faster content delivery, high-performance endpoints, and continuous improvements to its GraphQL API. These features are designed to support high-traffic, global audiences and provide practical advice for developers to optimize API usage. Source: High-Performance Endpoint Blog
Support & Troubleshooting
What support options are available for developers using the Management SDK?
Hygraph provides 24/7 support via chat, email, and phone, as well as real-time troubleshooting through Intercom chat. Developers can also access extensive documentation, community Slack channels, webinars, live streams, and how-to videos. Enterprise customers receive a dedicated Customer Success Manager and structured onboarding. Source: Hygraph Documentation, Hygraph Pricing, Enterprise CMS
How does Hygraph handle maintenance, upgrades, and troubleshooting?
Hygraph is a cloud-based platform, so all deployment, updates, and infrastructure maintenance are managed by Hygraph. Upgrades, such as new features and SDK improvements, are seamlessly integrated. Troubleshooting is supported by 24/7 support, extensive documentation, and real-time chat. Source: manual
Pricing & Plans
What does it cost to use Hygraph and the Management SDK?
Hygraph offers a Free Forever Developer Account for developers to explore and build projects at no cost. Self-service plans start at $299/month (or $199/month billed annually), and custom enterprise pricing starts at $900/month. Plans include 1,000 entries, with add-ons available for additional entries and locales. For more details, visit the Hygraph Pricing Page.
Use Cases & Customer Success
Who can benefit from using Hygraph and the Management SDK?
Hygraph and its Management SDK are ideal for developers, product managers, and marketing teams in industries such as ecommerce, automotive, technology, food and beverage, manufacturing, transportation, staffing, and science. Organizations looking to modernize legacy tech stacks, streamline content operations, and scale globally will benefit most. Source: ICPVersion2_Hailey.pdf, Case Studies
What are some real-world examples of companies using Hygraph successfully?
Notable companies using Hygraph include:
Komax: Achieved 3x faster time to market by managing 20,000+ product variations across 40+ markets. Read the case study.
Samsung: Improved customer engagement by 15% with a scalable, composable member platform. Read the case study.
Stobag: Increased online revenue share from 15% to 70% after digital transformation. Read the case study.
Customers frequently praise Hygraph's intuitive user interface, making it easy for both technical and non-technical users. Hygraph was recognized for "Best Usability" in Summer 2023, and users highlight its flexibility and accessibility. Source: Try Hygraph
Problems Solved & Competitive Advantages
What problems does Hygraph solve for its customers?
Hygraph addresses operational inefficiencies (reducing developer dependency, modernizing legacy tech stacks), financial challenges (lowering operational costs, accelerating speed-to-market), and technical issues (simplifying schema evolution, robust integrations, performance bottlenecks). Its user-friendly interface and GraphQL-native architecture make it a powerful tool for modern content management. Source: Hailey Feed .pdf
Why choose Hygraph over other headless CMS solutions?
Hygraph stands out with its GraphQL-native architecture, Smart Edge Cache, content federation, advanced localization, and developer-friendly APIs. It offers proven business outcomes (e.g., 3x faster time-to-market for Komax, 15% increase in engagement for Samsung), strong security/compliance, and dedicated support. Source: Case Studies
This document is a step by step of the example presented here.
This whole example is run at once, but here we will show you how to write it step by step.
The first thing you need to do is enable API access.
import{
Client,
RelationalFieldType,
SimpleFieldType,
VisibilityTypes,
}from'@hygraph/management-sdk';
const client =newClient({
authToken:'',
endpoint:'',
});
You can find the authToken and endpoint from your project's settings.
Authentication Token authToken: In your Hygraph project, go to Project Settings > Permanent Auth Tokens > Token. Make sure the token has proper management permissions depending on what you plan to execute via the SDK.
Hygraph Content API Endpoint endpoint: Endpoint of the Content API that belongs to the environment that you plan to interact with. In your Hygraph project, go to Project Settings > Endpoints > High Performance Content API.
Then, add simple fields. Here, we are adding a title, a simple field of type string, a slug field, a hidden integer field with custom field validation, a required & unique string field with custom regex validation for emails, a basic rich text field, a rich text with embeds and single allowed embeddable model, and a list of date/times:
// required title field of type string:
client.createSimpleField({
parentApiId:'Page',
type:SimpleFieldType.String,
apiId:'title',
displayName:'Title',
isTitle:true,
isRequired:true,
visibility:VisibilityTypes.ReadWrite,
});
// simple field of type string:
client.createSimpleField({
parentApiId:'Author',
type:SimpleFieldType.String,
apiId:'favouritePastime',
displayName:'Author Favourite Pastime',
isRequired:true,
visibility:VisibilityTypes.ReadWrite,
});
// slug field:
client.createSimpleField({
parentApiId:'Page',
type:SimpleFieldType.String,
apiId:'slug',
displayName:'Slug',
description:'Enter the slug for this page, such as about, blog, or contact',
isRequired:true,
isUnique:true,
tableRenderer:'GCMS_SLUG',
formRenderer:'GCMS_SLUG',
});
// hidden integer field with custom field validation:
client.createSimpleField({
parentApiId:'Page',
type:SimpleFieldType.Int,
apiId:'count',
displayName:'Count',
visibility:VisibilityTypes.Hidden,
validations:{
Int:{
range:{
max:1000,
min:0,
errorMessage:'Counter has to be between 0 and 1000',
},
},
},
});
// required + unique string field with custom regex validation for emails: