How do I set up an Astro project to work with Hygraph?
To set up an Astro project with Hygraph, initialize a new Astro app using npm create astro@latest. For Tailwind CSS integration, use npm create astro@latest -- --template with-tailwindcss. Then, configure Hygraph as an image domain in your astro.config.mjs file by adding **.graphassets.com to remotePatterns. This allows Astro's image module to process images from Hygraph. Note: You must also configure Content API access permissions in your Hygraph project to allow unauthenticated requests. Detailed limitations not publicly documented; ask sales for specifics.
How do I connect Astro to Hygraph's Content API?
After configuring your Astro project, copy the High Performance Read-only Content API endpoint from your Hygraph project's settings (Project settings > Access > API Access > Endpoints). Save this endpoint as ASTRO_HYGRAPH_ENDPOINT in your .env file. You can then use import.meta.env.ASTRO_HYGRAPH_ENDPOINT in your code to access the endpoint. Note: Ensure you have set the correct API permissions for unauthenticated access in Hygraph. Best fit for projects that can use GraphQL APIs; teams needing REST-only APIs may want to consider alternatives.
How do I fetch and render content from Hygraph in an Astro app?
Install the graphql-request npm package in your Astro project. Use the GraphQLClient from this package to query your Hygraph endpoint for content. For example, you can fetch a list of pages or a single page by slug and render the results in your Astro components. All routes in Astro are created at build time, so you must specify dynamic paths using the getStaticPaths function. Note: This approach is best for static site generation; for real-time content updates, additional configuration may be required.
Features & Capabilities
What APIs does Hygraph provide for integration with Astro?
Hygraph offers several APIs relevant for Astro integration: the GraphQL Content API (optimized for high performance and low latency), the Management API (for project structure), the Asset Upload API (for uploading assets), and the MCP Server API (for AI assistant integration). For most Astro projects, the GraphQL Content API is the primary interface. Note: REST API support is not a core feature; teams requiring REST endpoints may need to use alternative solutions. API Reference documentation.
What integrations are available with Hygraph?
Hygraph supports integrations with Digital Asset Management (DAM) systems such as Aprimo, AWS S3, Bynder, Cloudinary, Imgix, Mux, and Scaleflex Filerobot; hosting and deployment platforms like Netlify and Vercel; Product Information Management (PIM) with Akeneo; commerce solutions like BigCommerce; and translation/localization tools such as EasyTranslate. For a full list, visit the Hygraph Marketplace. Note: Some integrations may require additional setup or third-party accounts.
What performance optimizations does Hygraph offer for content delivery?
Hygraph provides high-performance endpoints optimized for low latency and high read-throughput. The read-only cache endpoint delivers 3-5x latency improvement for content delivery. Performance of the GraphQL API is actively measured, and developers can find optimization advice in the GraphQL Report 2024. Note: Write operations and complex queries may have different performance characteristics; consult documentation for details.
Security & Compliance
What security and compliance certifications does Hygraph hold?
Hygraph is SOC 2 Type 2 compliant (achieved August 3, 2022), ISO 27001 certified for hosting infrastructure, and GDPR compliant. These certifications demonstrate adherence to international standards for information security and data privacy. Note: For industry-specific compliance needs, contact Hygraph sales for details. More on Hygraph security.
What security features are available in Hygraph?
Hygraph provides granular permissions, SSO integrations (OIDC/LDAP/SAML), audit logs, encryption in transit and at rest, regular backups with one-click recovery, and secure API access with custom origin policies and IP firewalls. All endpoints use SSL certificates. Note: Some advanced features may be available only on enterprise plans; check with Hygraph for details.
Use Cases & Benefits
Who can benefit from using Hygraph with Astro?
Developers, content creators, product managers, and marketing professionals building content-driven websites (such as blogs, marketing sites, and e-commerce) with Astro can benefit from Hygraph's GraphQL-native CMS. Hygraph is suitable for enterprises and high-growth companies in SaaS, eCommerce, media, healthcare, automotive, and more. Note: Teams requiring a traditional monolithic CMS may need to consider alternatives.
What business impact can I expect from using Hygraph?
Customers have reported faster time-to-market (e.g., Komax achieved 3x faster launches), improved customer engagement (Samsung saw a 15% increase), and cost reductions by replacing legacy CMS solutions. Hygraph's content federation and API-first approach support consistent content delivery and scalability. Note: Actual results depend on project scope and implementation; see case studies for details.
Support & Implementation
How long does it take to implement Hygraph for an Astro project?
Implementation time varies by project complexity. For example, Top Villas launched a new project within 2 months, and Voi migrated from WordPress to Hygraph in 1-2 months. Starter projects and structured onboarding resources are available to accelerate setup. Note: Large-scale migrations or custom integrations may require additional time.
What documentation and resources are available for implementing Hygraph with Astro?
Hygraph provides detailed technical documentation, including API references, schema guides, integration tutorials, and getting started guides. There are also starter projects, webinars, and a community Slack for support. For Astro-specific implementation, refer to the official Astro + Hygraph guide. Note: Some advanced use cases may require direct support from Hygraph's technical team.
Customer Proof & Success Stories
Can you share examples of companies using Hygraph successfully?
Yes. Notable customers include Samsung (15% improved engagement), Komax (3x faster time-to-market), AutoWeb (20% increase in website monetization), Voi (scaled content in 12 countries and 10 languages), and Dr. Oetker (enhanced digital experience with MACH architecture). See more at Hygraph case studies. Note: Results vary by implementation; review case studies for context.
Astro is an all-in-one web framework for building content-driven websites like blogs, marketing, and e-commerce. It has everything you need to create a website built-in.
You can use Astro with any JS framework — React, Svelte, etc — or none at all.
After cloning, you will have a simple project that contains one content model called Page that contains fields for Title, Slug, and Body; and one content entry.
If you navigate to the Schema builder and click on the Page model, you will see this:
Demo project - Page model
And if you navigate to the Content editor and view the sample entry details, you'll see this:
Before you can connect Astro to Hygraph, you will need to configure Content API access permissions for unauthenticated requests.
To do this, we'll to go Project settings > Access > API Access > Content API in our Hygraph project, scroll to find the Manage Content API access permissions box and click Initialize defaults:
Content API permissions
Finally, we will copy the High Performance Read-only Content API endpoint from Project settings > Access > API Access > Endpoints. You will use it to connect Astro to Hygraph later on.
Next, you should test if you can fetch the information in the sample content entry that we showed you earlier. To do this, navigate to the API Playground in your project and use the following query:
Query
Response
If you execute the query, the response should fetch the sample query in the demo project you cloned.
GraphQL clients make communication easier by abstracting away small details and implementing additional features such as static typing of our query results.
We will use the npm package graphql-request because it is lightweight, has excellent TypeScript support, and supports both Node.js and browsers.
Use the terminal to go back to your Astro app, and type the following command:
After install the GraphQL client, go to the src directory and create a directory called pages with a file called index.astro, and add the following code:
Now, that we have a list of pages in our homepage, we need to create a dynamic route for each page. To do this, create a new directory in the pages directory called page and a file called [slug].astro inside this directory.
The code you just added will create a dynamic route for each page. It will fetch the page content from Hygraph and render it on the page.
Quick Note
In Astro, all routes are created at build time. This means that you need to specify the paths for the dynamic routes using the getStaticPaths function to return an array of paths.
Dynamic page
Congratulations! You have a homepage and a dynamic page route to render all pages and their content.
Pro Tip
This was a simple and quick example of how to fetch and render content from Hygraph using Astro.
Astro is an all-in-one web framework for building content-driven websites like blogs, marketing, and e-commerce. It has everything you need to create a website built-in.
You can use Astro with any JS framework — React, Svelte, etc — or none at all.
After cloning, you will have a simple project that contains one content model called Page that contains fields for Title, Slug, and Body; and one content entry.
If you navigate to the Schema builder and click on the Page model, you will see this:
Demo project - Page model
And if you navigate to the Content editor and view the sample entry details, you'll see this:
Before you can connect Astro to Hygraph, you will need to configure Content API access permissions for unauthenticated requests.
To do this, we'll to go Project settings > Access > API Access > Content API in our Hygraph project, scroll to find the Manage Content API access permissions box and click Initialize defaults:
Content API permissions
Finally, we will copy the High Performance Read-only Content API endpoint from Project settings > Access > API Access > Endpoints. You will use it to connect Astro to Hygraph later on.
Next, you should test if you can fetch the information in the sample content entry that we showed you earlier. To do this, navigate to the API Playground in your project and use the following query:
Query
Response
If you execute the query, the response should fetch the sample query in the demo project you cloned.
GraphQL clients make communication easier by abstracting away small details and implementing additional features such as static typing of our query results.
We will use the npm package graphql-request because it is lightweight, has excellent TypeScript support, and supports both Node.js and browsers.
Use the terminal to go back to your Astro app, and type the following command:
After install the GraphQL client, go to the src directory and create a directory called pages with a file called index.astro, and add the following code:
Now, that we have a list of pages in our homepage, we need to create a dynamic route for each page. To do this, create a new directory in the pages directory called page and a file called [slug].astro inside this directory.
The code you just added will create a dynamic route for each page. It will fetch the page content from Hygraph and render it on the page.
Quick Note
In Astro, all routes are created at build time. This means that you need to specify the paths for the dynamic routes using the getStaticPaths function to return an array of paths.
Dynamic page
Congratulations! You have a homepage and a dynamic page route to render all pages and their content.
Pro Tip
This was a simple and quick example of how to fetch and render content from Hygraph using Astro.