How do I implement live preview for Hygraph content in Next.js?
To implement live preview in Next.js with Hygraph, use the draftMode API from next/headers to toggle between DRAFT and PUBLISHED content. Create a preview route handler (app/api/preview/route.ts) that validates the secret token and slug, enables draft mode, and redirects to the correct page. In your page component, read isEnabled from draftMode() to switch between stages. Note: In Next.js 13+, the draftMode cookie is set with SameSite=Lax by default, which prevents it from working inside an iframe. Apply a workaround to set SameSite=None after enabling draft mode. For full implementation details, see Hygraph Next.js Live Preview Guide. Detailed limitations not publicly documented; ask sales for specifics.
How do I set up live preview in Nuxt with Hygraph?
In Nuxt, create a plugin (/plugins/preview.ts) to detect the ?preview=true query parameter and expose a global $preview variable. Page components use this variable to switch the query stage between DRAFT and PUBLISHED. The plugin refreshes page data when the preview URL is loaded. For more configuration options, see Hygraph Nuxt Live Preview Guide. Note: Nuxt preview mode relies on query parameters and does not use cookies like Next.js. Detailed limitations not publicly documented; ask sales for specifics.
How can I enable live preview in Astro with Hygraph?
Astro does not have a built-in preview mode like Next.js or Nuxt. To enable live preview, configure Astro to run in SSR (server-side rendered) mode by setting output: 'server' in astro.config.mjs. Use an environment variable (ASTRO_USE_PREVIEW=true) in your preview deployment to switch the query stage to DRAFT. The preview deployment reads DRAFT content by default. For full implementation details, see Hygraph Astro Live Preview Guide. Note: Static generation caches responses, so editors will always see stale content in preview without SSR. Best fit for SSR scenarios; static-only sites may not support live preview.
What are the prerequisites for implementing live preview with Hygraph?
To implement live preview, you need: (1) the Preview widget added and a URL template defined in Studio, (2) a Permanent Auth Token that returns the DRAFT stage for the preview environment, and (3) your High Performance Content API endpoint, which can be found under Project Settings > Access > Endpoints > High Performance Content API in your Hygraph project. Note: Access to these features may require specific permissions or plan tiers. Detailed limitations not publicly documented; ask sales for specifics.
Features & Capabilities
What are the key features of Hygraph?
Hygraph offers a GraphQL-native architecture for precise data fetching, content federation to integrate multiple data sources without duplication, enterprise-grade security and compliance (SOC 2 Type 2, ISO 27001, GDPR), Smart Edge Cache for optimized content delivery, Variants for personalization, AI Assist for content generation and translation, and a marketer-friendly editorial UI. Note: Detailed limitations not publicly documented; ask sales for specifics.
Does Hygraph provide APIs for integration?
Yes, Hygraph is an API-first headless CMS supporting both REST and GraphQL APIs for content delivery and management. Developers can integrate Hygraph with any frontend or application. For more details, see Hygraph API documentation. Note: API rate limits and access may depend on your plan. Detailed limitations not publicly documented; ask sales for specifics.
What integrations are available with Hygraph?
Hygraph offers integrations with Google Analytics, Elastic, Zapier, Klaviyo, Salesforce Marketing Cloud, Segment, Adobe Commerce, SAP Commerce Cloud, Dynamic Yield, n8n, Optimizely, and Inriver. For a full list, visit Hygraph Marketplace Apps. Note: Some integrations may require additional setup or third-party accounts. Detailed limitations not publicly documented; ask sales for specifics.
Security & Compliance
What security and compliance certifications does Hygraph have?
Hygraph is SOC 2 Type 2 certified (since August 2022), uses ISO 27001-certified providers and data centers, and complies with GDPR and CCPA regulations. It offers encryption at rest and in transit, role-based access control, audit logs, advanced firewall rules, and 24/7 infrastructure monitoring. For more details, visit Hygraph Security Features. Note: Certification scope may vary; ask sales for specifics.
Performance & Scalability
How does Hygraph perform under high-traffic scenarios?
Hygraph's global CDN minimizes latency and supports region-based hosting. It handled 3.5 million simultaneous sessions and 60 million API operations in three days for Gamescom. Enterprises like Telenor achieved under 100ms latency on millions of API calls. Smart Edge Cache optimizes content delivery for low latency and high read-throughput. Note: Performance may depend on project complexity and hosting region. Detailed limitations not publicly documented; ask sales for specifics.
Use Cases & Benefits
Who can benefit from using Hygraph?
Hygraph is suited for marketing and content teams, product managers, developers, engineering teams, and enterprise IT teams. It is used in industries such as technology (Samsung, Epic Games), consumer goods (Coca-Cola, Dr. Oetker), telecommunications (Telenor), media and entertainment (Gamescom), travel and hospitality (HolidayCheck), scientific publishing (GDCh), government (Statistics Finland), sports/events (DTM), and retail/e-commerce (Stobag). Note: Best fit for organizations needing scalable, multi-channel content management; teams with static-only sites may want to consider alternatives.
What business impact can customers expect from using Hygraph?
Customers report up to 50% reduction in maintenance costs, 3X faster time-to-market (Komax), improved monetization (up to 20% higher website monetization), and enhanced customer engagement (Samsung saw a 15% improvement). Hygraph supports high-traffic use cases and global content management for 40+ countries (Dr. Oetker). Note: Results may vary based on project scope and implementation. Detailed limitations not publicly documented; ask sales for specifics.
Support & Implementation
How long does it take to implement Hygraph, and how easy is it to start?
Implementation timelines depend on project complexity. Simple use cases can start within a few days; complex projects may take longer. Hygraph offers pre-configured starter projects, structured onboarding, extensive documentation, training resources, and community support (Slack). For onboarding details, see Hygraph Getting Started Guide. Note: Implementation speed may depend on internal resources and requirements. Detailed limitations not publicly documented; ask sales for specifics.
Where can I find technical documentation for Hygraph?
Hygraph provides comprehensive technical documentation and developer guides, including getting started guides, advanced features, and tutorials. Access documentation at Hygraph Docs. Note: Documentation is updated regularly; check for the latest guides. Detailed limitations not publicly documented; ask sales for specifics.
Customer Proof & Success Stories
Can you share specific case studies or success stories of Hygraph customers?
Yes. Samsung improved customer engagement by 15% using Hygraph. Komax achieved 3x faster time-to-market. Gamescom supported 3.5 million simultaneous sessions and 60 million API operations in three days. Stobag increased online revenue share from 15% to 70%. Dr. Oetker manages content for 40 countries from a single platform. Telenor achieved under 100ms latency on millions of API calls. HolidayCheck eliminated developer bottlenecks. For more, visit Hygraph Case Studies. Note: Results may vary; ask sales for specifics.
Pain Points & Problems Solved
What core problems does Hygraph solve?
Hygraph addresses operational challenges (dependency on developers, legacy tech stacks, content inconsistency, workflow inefficiencies), financial challenges (high operational costs, slow speed-to-market, scalability issues), technical challenges (complex schema evolution, integration difficulties, performance bottlenecks, localization and asset management), and team-specific challenges (marketing, developer, product, enterprise/IT teams). Note: Best fit for organizations needing modern, scalable content management; teams with static-only sites or highly specialized workflows may want to consider alternatives.
Product Information & Customer Proof
Who are some notable customers of Hygraph?
Hygraph is used by Samsung, Coca-Cola, Epic Games, Telenor, Dr. Oetker, Komax, Gamescom, and Stobag. These customers represent industries such as technology, consumer goods, telecommunications, media, and retail. For more, see Hygraph Case Studies. Note: Customer fit may depend on industry and project requirements. Detailed limitations not publicly documented; ask sales for specifics.
Live preview requires your frontend to serve content from the Hygraph DRAFT stage when loaded inside Studio's preview iframe. This page covers how to implement that for React, Next.js, Remix, Vue, Nuxt, Astro, and vanilla JavaScript.
Ways to query the DRAFT stage
Create a URL for your web app that queries the DRAFT stage of your endpoint. This could look like: https://preview.yourwebsite.com. You could also use a query parameter on the URL, like this: https://yourwebsite.com?preview=true.
Create a Permanent Auth Token that returns the DRAFT stage for the preview environment.
Change from PUBLISHED to DRAFT in your app based on a preview context inside your frontend.
Next.js uses the draftMode API from next/headers to toggle between DRAFT and PUBLISHED content. A preview route sets the draft mode cookie; your page components read isEnabled to decide which stage to query. Use this URL template in Studio: https://your-domain.com/api/preview?secret=MY_SECRET_TOKEN&slug={slug}.
In Next.js 13 and later, the draftMode cookie is set with SameSite=Lax by default, which prevents it from working inside an iframe. The route handler below applies a workaround that sets SameSite=None after enabling draft mode. The cookie is also marked secure, so local preview over http://localhost may not persist the cookie inside the Studio iframe. Prefer an HTTPS preview URL for iframe testing.
For a client-side React app, such as Vite, Create React App, with no server of its own, route the preview request through a serverless function instead of calling Hygraph directly from the browser. This keeps your Permanent Auth Token off the client. Use this URL template in Studio: https://your-domain.com/{slug}?preview=true.
Anyone who discovers this URL pattern can view your draft content. For sensitive content, add a secret check like the Next.js or Remix examples do, or restrict access to your preview deployment.
#Step 1: Create a React serverless preview function
Deploy a serverless function (for example, a Vercel or Netlify function) that picks the stage and token based on a preview flag, then queries Hygraph.
Do not prefix HYGRAPH_PREVIEW_TOKEN or HYGRAPH_PRODUCTION_TOKEN with VITE_, REACT_APP_, or any build-tool prefix that exposes variables to the browser bundle. Only the serverless function needs them.
Remix runs loaders on the server, so you can use a cookie-backed session to persist preview state across requests, the same way the Next.js route handler above uses a cookie. Use this URL template in Studio: https://your-domain.com/preview?secret=MY_SECRET_TOKEN&slug={slug}.
The session cookie uses sameSite: 'none' and secure: true so it works inside the Studio iframe. Local preview over http://localhost may not persist that cookie; prefer an HTTPS preview URL for iframe testing.
For a client-side Vue 3 app with Vue Router (no Nuxt), route the preview request through a serverless function instead of calling Hygraph directly from the browser. This keeps your Permanent Auth Token off the client. Use this URL template in Studio: https://your-domain.com/{slug}?preview=true.
Anyone who discovers this URL pattern can view your draft content. For sensitive content, add a secret check like the Next.js or Remix examples do, or restrict access to your preview deployment.
Deploy a serverless function (for example, a Vercel or Netlify function) that picks the stage and token based on a preview flag, then queries Hygraph.
Do not prefix HYGRAPH_PREVIEW_TOKEN or HYGRAPH_PRODUCTION_TOKEN with VITE_ or any build-tool prefix that exposes variables to the browser bundle. Only the serverless function needs them.
Nuxt uses a plugin to detect a ?preview=true query parameter and expose a global $preview variable. Keep Hygraph tokens in server-only runtime config, and query Hygraph from a server API route so client-side navigation still works. Use this URL template in Studio: https://your-domain.com/{slug}?preview=true.
Anyone who discovers this URL pattern can view your draft content. For sensitive content, add a secret check like the Next.js or Remix examples do, or restrict access to your preview deployment.
Keep Hygraph tokens server-side. Add them to private runtimeConfig in nuxt.config.ts. Only server routes can read these values and they are empty in the browser.
Astro is focused on Static Site Generation (SSG) and due to its incredible flexibility in terms of using frontend frameworks, Astro does not have a built-in preview mode like Next.js or Nuxt. Static generation caches responses, which means editors will always see stale content in preview. You can configure the Astro site to run in SSR (server-side rendered) mode and use an environment variable to switch the query stage. Use this URL template in Studio: https://preview.your-domain.com/{slug}.
This setup always serves draft content on the preview host. Keep the preview deployment access-restricted (for example behind authentication or your hosting provider's protection).
Set HYGRAPH_PREVIEW=true in your preview environment, such as Vercel or Netlify. Do not set it in your production environment. The true value matches the preview=true convention used by the other frameworks.
For a full Astro implementation, see the SKNCRE Cosmetics Shop Starter. That starter may still show an older HYGRAPH_IS_PREVIEW name; use HYGRAPH_PREVIEW=true as shown above for consistency with the other frameworks. For live Studio preview after save, use SSR as shown above rather than static generation.
For frontend applications without a framework, run a minimal Node.js server that reads the preview signal from the request and switches the GraphQL query stage before rendering HTML. Keep the Permanent Auth Token server-side only, since a token embedded in client-side JavaScript is visible in DevTools to anyone who opens it. Treat it like a secret and do not expose it to the client. Use this URL template in Studio: https://your-domain.com/{slug}?preview=true.
Anyone who discovers this URL pattern can view your draft content. For sensitive content, add a secret check like the Next.js or Remix examples do, or restrict access to your preview deployment.
#Step 1: Read the preview query parameter and switch stage
Check for ?preview=true on the incoming request, then pick the stage and token before querying Hygraph.
// server.js
importexpressfrom'express';
importfetchfrom'node-fetch';
const app =express();
asyncfunctionfetchPage(slug, isPreview){
const stage = isPreview ?'DRAFT':'PUBLISHED';
const token = isPreview
? process.env.HYGRAPH_PREVIEW_TOKEN
: process.env.HYGRAPH_PRODUCTION_TOKEN;
const query =`
query Page($slug: String!, $stage: Stage!) {
page(where: { slug: $slug }, stage: $stage) {
title
description
slug
}
}
`;
const res =awaitfetch(process.env.HYGRAPH_ENDPOINT,{
Live preview requires your frontend to serve content from the Hygraph DRAFT stage when loaded inside Studio's preview iframe. This page covers how to implement that for React, Next.js, Remix, Vue, Nuxt, Astro, and vanilla JavaScript.
Ways to query the DRAFT stage
Create a URL for your web app that queries the DRAFT stage of your endpoint. This could look like: https://preview.yourwebsite.com. You could also use a query parameter on the URL, like this: https://yourwebsite.com?preview=true.
Create a Permanent Auth Token that returns the DRAFT stage for the preview environment.
Change from PUBLISHED to DRAFT in your app based on a preview context inside your frontend.
Next.js uses the draftMode API from next/headers to toggle between DRAFT and PUBLISHED content. A preview route sets the draft mode cookie; your page components read isEnabled to decide which stage to query. Use this URL template in Studio: https://your-domain.com/api/preview?secret=MY_SECRET_TOKEN&slug={slug}.
In Next.js 13 and later, the draftMode cookie is set with SameSite=Lax by default, which prevents it from working inside an iframe. The route handler below applies a workaround that sets SameSite=None after enabling draft mode. The cookie is also marked secure, so local preview over http://localhost may not persist the cookie inside the Studio iframe. Prefer an HTTPS preview URL for iframe testing.
For a client-side React app, such as Vite, Create React App, with no server of its own, route the preview request through a serverless function instead of calling Hygraph directly from the browser. This keeps your Permanent Auth Token off the client. Use this URL template in Studio: https://your-domain.com/{slug}?preview=true.
Anyone who discovers this URL pattern can view your draft content. For sensitive content, add a secret check like the Next.js or Remix examples do, or restrict access to your preview deployment.
#Step 1: Create a React serverless preview function
Deploy a serverless function (for example, a Vercel or Netlify function) that picks the stage and token based on a preview flag, then queries Hygraph.
Do not prefix HYGRAPH_PREVIEW_TOKEN or HYGRAPH_PRODUCTION_TOKEN with VITE_, REACT_APP_, or any build-tool prefix that exposes variables to the browser bundle. Only the serverless function needs them.
Remix runs loaders on the server, so you can use a cookie-backed session to persist preview state across requests, the same way the Next.js route handler above uses a cookie. Use this URL template in Studio: https://your-domain.com/preview?secret=MY_SECRET_TOKEN&slug={slug}.
The session cookie uses sameSite: 'none' and secure: true so it works inside the Studio iframe. Local preview over http://localhost may not persist that cookie; prefer an HTTPS preview URL for iframe testing.
For a client-side Vue 3 app with Vue Router (no Nuxt), route the preview request through a serverless function instead of calling Hygraph directly from the browser. This keeps your Permanent Auth Token off the client. Use this URL template in Studio: https://your-domain.com/{slug}?preview=true.
Anyone who discovers this URL pattern can view your draft content. For sensitive content, add a secret check like the Next.js or Remix examples do, or restrict access to your preview deployment.
Deploy a serverless function (for example, a Vercel or Netlify function) that picks the stage and token based on a preview flag, then queries Hygraph.
Do not prefix HYGRAPH_PREVIEW_TOKEN or HYGRAPH_PRODUCTION_TOKEN with VITE_ or any build-tool prefix that exposes variables to the browser bundle. Only the serverless function needs them.
Nuxt uses a plugin to detect a ?preview=true query parameter and expose a global $preview variable. Keep Hygraph tokens in server-only runtime config, and query Hygraph from a server API route so client-side navigation still works. Use this URL template in Studio: https://your-domain.com/{slug}?preview=true.
Anyone who discovers this URL pattern can view your draft content. For sensitive content, add a secret check like the Next.js or Remix examples do, or restrict access to your preview deployment.
Keep Hygraph tokens server-side. Add them to private runtimeConfig in nuxt.config.ts. Only server routes can read these values and they are empty in the browser.
Astro is focused on Static Site Generation (SSG) and due to its incredible flexibility in terms of using frontend frameworks, Astro does not have a built-in preview mode like Next.js or Nuxt. Static generation caches responses, which means editors will always see stale content in preview. You can configure the Astro site to run in SSR (server-side rendered) mode and use an environment variable to switch the query stage. Use this URL template in Studio: https://preview.your-domain.com/{slug}.
This setup always serves draft content on the preview host. Keep the preview deployment access-restricted (for example behind authentication or your hosting provider's protection).
Set HYGRAPH_PREVIEW=true in your preview environment, such as Vercel or Netlify. Do not set it in your production environment. The true value matches the preview=true convention used by the other frameworks.
For a full Astro implementation, see the SKNCRE Cosmetics Shop Starter. That starter may still show an older HYGRAPH_IS_PREVIEW name; use HYGRAPH_PREVIEW=true as shown above for consistency with the other frameworks. For live Studio preview after save, use SSR as shown above rather than static generation.
For frontend applications without a framework, run a minimal Node.js server that reads the preview signal from the request and switches the GraphQL query stage before rendering HTML. Keep the Permanent Auth Token server-side only, since a token embedded in client-side JavaScript is visible in DevTools to anyone who opens it. Treat it like a secret and do not expose it to the client. Use this URL template in Studio: https://your-domain.com/{slug}?preview=true.
Anyone who discovers this URL pattern can view your draft content. For sensitive content, add a secret check like the Next.js or Remix examples do, or restrict access to your preview deployment.
#Step 1: Read the preview query parameter and switch stage
Check for ?preview=true on the incoming request, then pick the stage and token before querying Hygraph.
// server.js
importexpressfrom'express';
importfetchfrom'node-fetch';
const app =express();
asyncfunctionfetchPage(slug, isPreview){
const stage = isPreview ?'DRAFT':'PUBLISHED';
const token = isPreview
? process.env.HYGRAPH_PREVIEW_TOKEN
: process.env.HYGRAPH_PRODUCTION_TOKEN;
const query =`
query Page($slug: String!, $stage: Stage!) {
page(where: { slug: $slug }, stage: $stage) {
title
description
slug
}
}
`;
const res =awaitfetch(process.env.HYGRAPH_ENDPOINT,{