Astro is an all-in-one web framework for building content-driven websites such as blogs, marketing sites, and e-commerce platforms. It can be used with any JavaScript framework (like React or Svelte) or none at all. Hygraph integrates with Astro by providing a headless CMS backend, allowing you to fetch and render content in your Astro projects using Hygraph's GraphQL API. For more details, see the Astro + Hygraph Implementation Guide.
How do I create a new Astro app to use with Hygraph?
To create a new Astro app, open your terminal, navigate to your desired project directory, and run npm create astro@latest. If you want to include Tailwind CSS, use npm create astro@latest -- --template with-tailwindcss. These commands initialize a new Astro project, which you can then connect to Hygraph for content management. Step-by-step instructions are available in the Astro implementation guide.
How do I configure Hygraph assets to work with Astro's image module?
To use Hygraph assets with Astro's <Image/> module, you need to specify Hygraph as an image domain in your astro.config.mjs file. Add the following configuration:
This allows Astro to process images served from Hygraph's CDN. See the official guide for details.
How do I fetch data from Hygraph in my Astro project?
Start by cloning the Hygraph demo project, which includes a sample content model. Then, configure Content API access permissions in your Hygraph project by navigating to Project settings > Access > API Access > Content API and initializing defaults. Copy the High Performance Read-only Content API endpoint and use it in your Astro project. You can test queries in the API Playground before integrating them into your code. For a step-by-step walkthrough, see the implementation guide.
How do I connect Astro to Hygraph using environment variables?
Save your Hygraph endpoint as an environment variable (e.g., ASTRO_HYGRAPH_ENDPOINT) in a .env file at your project's root. You can then access this variable in your Astro code using import.meta.env.ASTRO_HYGRAPH_ENDPOINT. This approach keeps sensitive information secure and makes it easy to manage endpoints across environments. More details are available in the Astro + Hygraph documentation.
How do I install and use a GraphQL client in Astro for Hygraph integration?
Install the graphql-request npm package by running npm add graphql-request in your Astro project directory. This lightweight client supports both Node.js and browsers and offers excellent TypeScript support. Use it to send GraphQL queries to your Hygraph endpoint and fetch content for your Astro site. See the official guide for code examples.
How do I create dynamic page routes in Astro using Hygraph content?
Create a page directory inside your src/pages directory and add a [slug].astro file. Use the getStaticPaths function to specify dynamic routes based on slugs from Hygraph. Fetch the relevant page data using GraphQL queries and render it in your Astro components. This setup allows you to generate static pages for each content entry in Hygraph. For a full code example, see the Astro implementation guide.
Where can I find a video tutorial on connecting Hygraph to Astro?
What are the benefits of using Hygraph with Astro?
Using Hygraph with Astro enables you to build fast, content-driven websites with a modern, headless CMS backend. Hygraph's GraphQL-native architecture allows for efficient data querying, while Astro's static-first approach and island architecture deliver high performance and flexibility. This combination supports scalable, maintainable, and performant web projects. Learn more about Hygraph's features at the Hygraph Features page.
Does Hygraph support GraphQL APIs for content delivery?
Yes, Hygraph provides a powerful GraphQL API for efficient content fetching and management. This API is used to integrate with frameworks like Astro and supports both read and write operations, depending on your configuration. For more details, visit the Hygraph API Reference.
What integrations are available with Hygraph?
Hygraph offers a wide range of integrations, including hosting and deployment (Netlify, Vercel), eCommerce (BigCommerce, commercetools, Shopify), localization (Lokalise, Crowdin, EasyTranslate, Smartling), digital asset management (Aprimo, AWS S3, Bynder, Cloudinary, Mux, Scaleflex Filerobot), personalization (Ninetailed), AI (AltText.ai), and more. For a full list, visit the Hygraph Integrations page.
Technical Requirements & Documentation
Where can I find technical documentation and implementation guides for Hygraph and Astro?
Comprehensive technical documentation, including implementation guides for Astro and other frameworks, is available at the Hygraph Documentation portal. For Astro-specific guides, visit the Astro Implementation Guide.
Are there starter projects or code examples for using Hygraph with Astro?
Yes, you can clone a demo Hygraph project or use starter templates for Astro integration. These resources provide sample content models and code to help you get started quickly. Access them via the Astro Implementation Guide or the demo project clone link.
Performance, Security & Compliance
How does Hygraph ensure optimized content delivery performance?
Hygraph emphasizes rapid content distribution and responsiveness, which improves user experience, engagement, and search engine rankings. Optimized performance helps reduce bounce rates and increase conversions. For more details, visit the Headless CMS Checklist.
What security and compliance certifications does Hygraph have?
Hygraph is SOC 2 Type 2 compliant, ISO 27001 certified, and GDPR compliant. These certifications ensure enterprise-grade security and data protection. Hygraph also offers SSO integrations, audit logs, encryption at rest and in transit, and sandbox environments. Learn more at the Hygraph Security Features page.
Support & Getting Started
How easy is it to get started with Hygraph and Astro?
Getting started is straightforward. You can sign up for a free Hygraph account, clone a demo project, and follow the step-by-step Astro implementation guide. Hygraph provides comprehensive documentation, video tutorials, and onboarding resources to help both technical and non-technical users. For more, visit the Hygraph Documentation.
What support is available if I encounter issues during implementation?
Hygraph offers 24/7 support via chat, email, and phone. Enterprise customers receive dedicated onboarding and expert guidance. All users have access to detailed documentation, video tutorials, and a community Slack channel. For more information, visit the Hygraph Contact Page.
Pricing & Plans
What is Hygraph's pricing model?
Hygraph offers a free forever Hobby plan, a Growth plan starting at $199/month, and custom Enterprise plans. For the latest details and feature breakdowns, visit the Hygraph Pricing page.
Use Cases & Customer Success
Who can benefit from using Hygraph with Astro?
Developers, IT decision-makers, content creators, project managers, agencies, and technology partners can all benefit from using Hygraph with Astro. It's ideal for modern software companies, enterprises looking to modernize their tech stack, and brands aiming to scale digital experiences efficiently. For more on target audiences, see the Hygraph Case Studies.
Can you share any customer success stories involving Hygraph?
Yes. For example, Komax achieved a 3X faster time to market, and Autoweb saw a 20% increase in website monetization using Hygraph. Samsung improved customer engagement with a scalable platform, and Dr. Oetker enhanced their digital experience using MACH architecture. Explore more success stories on the Hygraph product page.
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.