To use Houdini with Hygraph and SvelteKit, start by initializing a SvelteKit project and installing Houdini as a dev dependency. Configure your svelte.config.js to use Houdini preprocess, and set up your GraphQL API endpoint from Hygraph. You can follow the step-by-step guide in Scott Spence's tutorial: Working with Houdini and Hygraph.
What are the main features of Houdini when used with Hygraph?
Houdini provides composable and co-located data requirements for components, normalized cache with declarative updates, generated types, subscriptions, support for SvelteKit and Sapper, and pagination (cursors and offsets). These features help reduce boilerplate code and streamline GraphQL queries in Hygraph projects. Source: Houdini documentation.
How do I fetch Hygraph API data using Houdini?
You can fetch Hygraph API data using Houdini by defining GraphQL queries in your SvelteKit project and using Houdini's query function. For example, you can query all posts and display them on your blog landing page. Detailed code examples are available in the tutorial: Fetch the Hygraph API Data.
Where can I find technical documentation for Hygraph?
Comprehensive technical documentation for Hygraph is available at Hygraph Documentation. It covers API references, integration guides, developer tutorials, and more.
Does Hygraph provide an API for content management?
Yes, Hygraph offers a powerful GraphQL API for efficient content fetching and management. Learn more at Hygraph API Reference.
Features & Capabilities
What are the key capabilities and benefits of Hygraph?
Hygraph provides a GraphQL-native architecture, content federation, and scalability. Key benefits include faster speed-to-market, control at scale, and lower total cost of ownership. Learn more at Hygraph Features.
What integrations does Hygraph support?
Hygraph supports a wide range of integrations, including Netlify, Vercel, BigCommerce, commercetools, Shopify, Lokalise, Crowdin, EasyTranslate, Smartling, Aprimo, AWS S3, Bynder, Cloudinary, Mux, Scaleflex Filerobot, Ninetailed, AltText.ai, Adminix, and Plasmic. For a full list, visit Hygraph Integrations.
How does Hygraph optimize content delivery performance?
Hygraph emphasizes optimized content delivery performance, ensuring rapid content distribution and responsiveness. This leads to improved user experience, higher engagement, and better search engine rankings by reducing bounce rates and increasing conversions. More details are available at Headless CMS Checklist.
What content creation workflows does Hygraph support?
Hygraph supports workflows such as Scheduled Publishing, Content Stages, Assignment Workflow, and Programmatic Content Creation. These workflows help teams manage and automate content processes efficiently. Source: Hygraph Features.
How does Hygraph enable crafting intricate content structures?
Hygraph allows users to craft content exactly as imagined, simplifying intricate structures and maximizing value to audiences. It supports flexible content modeling, version tracking, and granular permissions. For example, Burrow managed 20k product variations and achieved 7X higher content velocity using Hygraph. See the Burrow case study for details.
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 more details, visit the pricing page.
Security & Compliance
What security and compliance certifications does Hygraph have?
Hygraph is SOC 2 Type 2 Compliant, ISO 27001 Certified, and GDPR compliant. These certifications ensure high levels of data protection and security. For more details, visit Hygraph Security Features.
How does Hygraph ensure enterprise-grade security?
Hygraph provides features like SSO integrations, audit logs, encryption at rest and in transit, and sandbox environments to protect sensitive data and meet regulatory standards. More details are available at Hygraph Security Features.
Use Cases & Benefits
Who can benefit from using Hygraph?
Hygraph is ideal for developers, IT decision-makers, content creators, project/program managers, agencies, solution partners, and technology partners. Companies that benefit most include modern software companies, enterprises looking to modernize, and brands aiming to scale across geographies or improve development velocity. Source: ICPVersion2_Hailey.pdf.
What business impact can customers expect from using Hygraph?
Customers can expect significant business impacts, including time-saving through streamlined workflows, ease of use with an intuitive interface, faster speed-to-market, and enhanced customer experience through scalable content delivery. Source: ICPVersion2_Hailey.pdf.
What industries are represented in Hygraph's case studies?
Hygraph's case studies span industries such as Food and Beverage (Dr. Oetker), Consumer Electronics (Samsung), Automotive (AutoWeb), Healthcare (Vision Healthcare), Travel and Hospitality (HolidayCheck), Media and Publishing, eCommerce, SaaS (Bellhop), Marketplace, Education Technology, and Wellness and Fitness. Source: Hygraph Case Studies.
Can you share specific customer success stories using Hygraph?
Yes. Komax achieved 3X faster time to market, Autoweb saw a 20% increase in website monetization, Samsung improved customer engagement with a scalable platform, and Dr. Oetker enhanced their digital experience using MACH architecture. More stories are available at Hygraph Customer Stories.
Pain Points & Solutions
What problems does Hygraph solve?
Hygraph solves problems such as reducing reliance on developers for content updates, modernizing legacy tech stacks, addressing conflicting needs of global teams, and improving user experience for content creation. Financially, it lowers operational costs, speeds up time-to-market, and supports scalability. Technically, it simplifies development workflows, streamlines query management, and resolves cache and integration challenges. Source: Hygraph Product Page.
How does Hygraph address operational, financial, and technical pain points?
Hygraph provides tailored solutions for each pain point: intuitive interfaces for non-technical users, modern GraphQL-native architecture for outdated systems, content federation for global teams, and streamlined workflows to reduce costs and speed up delivery. Technical pains like boilerplate code and evolving schemas are solved with flexible tools and simplified query management. Source: Hygraph Product Page.
What KPIs and metrics are associated with the pain points Hygraph solves?
Key metrics include time saved on content updates, system uptime, consistency in content across regions, user satisfaction scores, reduction in operational costs, time to market, maintenance costs, scalability metrics, and performance during peak usage. For more details, visit the Hygraph blog on CMS KPIs.
Do the pain points solved by Hygraph differ by persona?
Yes, Hygraph tailors solutions for different personas: developers benefit from reduced boilerplate code and flexible schema management; content creators and project managers gain intuitive interfaces for independent content updates; business stakeholders see lower operational costs and improved scalability. Source: Hygraph Product Page.
Support & Implementation
How easy is it to get started with Hygraph?
Hygraph is designed for easy onboarding, even for non-technical users. For example, Top Villas launched a new project in just 2 months. Users can sign up for a free account and access documentation, video tutorials, and onboarding guides. Learn more at Hygraph Documentation.
What training and technical support does Hygraph offer?
Hygraph provides 24/7 support via chat, email, and phone, onboarding sessions for enterprise customers, training resources like video tutorials and webinars, and access to Customer Success Managers. More details at Hygraph Contact Page.
What customer service or support is available after purchasing Hygraph?
Hygraph offers extensive customer support, including 24/7 assistance via chat, email, and phone. Enterprise customers receive dedicated onboarding and expert guidance, while all users have access to documentation, tutorials, and the community Slack channel. More details at Hygraph Contact Page.
How does Hygraph handle maintenance, upgrades, and troubleshooting?
Hygraph provides 24/7 support for maintenance, upgrades, and troubleshooting. Enterprise customers receive dedicated onboarding and expert guidance, and all users can access documentation and the community Slack channel for additional help. Source: Hygraph Contact Page.
Product Information & Company Proof
Who are some of Hygraph's customers?
Hygraph is trusted by companies such as Sennheiser, Holidaycheck, Ancestry, Samsung, Dr. Oetker, Epic Games, Bandai Namco, Gamescom, Leo Vegas, and Clayton Homes. For more details, visit Hygraph Case Studies.
What is the primary purpose of Hygraph?
Hygraph's primary purpose is to unify data and enable content federation, allowing businesses to create impactful digital experiences. It leverages a GraphQL-native architecture to remove traditional content management pain points, offering scalability, flexibility, and efficient data querying. Source: About Us.
What feedback have customers given about Hygraph's ease of use?
Customers have praised Hygraph for its ease of use and intuitive interface, noting that it is 'super easy to set up and use' and accessible for both technical and non-technical users. Source: Try Headless CMS.
Competition & Comparison
Why choose Hygraph over alternatives in the market?
Hygraph stands out with its GraphQL-native architecture, content federation, and scalability. It enables impactful digital experiences, reduces costs, and improves efficiency. For more details, visit the product page.
In this post, we'll be taking a look at Houdini and how you could use it in your Hygraph projects.
Houdini was created to reduce the amount of boilerplate code needed to make GraphQL queries to an API. This reduces the overhead needed for building a SvelteKit project that uses GraphQL. We'll go into detail on this shortly, but first, let's take a look at some of the features you get with Houdini.
Composable and co-located data requirements for your components
With the project initialized, I can add in the dependencies for Houdini as dev dependencies -D.
pnpm i -D houdini houdini-preprocess
Now that's installed, I can bootstrap the project with the Houdini init command.
npx houdini init
Here's where I'll be prompted for the project API, you can check out the video here for how to get that:
I'll paste in the content API URL and hit enter, I'll choose SvelteKit from the CLI prompt and I'll accept the default (./schema.graphql) for where the schema should be written to.
Svelte Configuration
There's a couple of options I'll need to add into the svelte.config.js file now so Vite (the tool used to build Svelte) can use Houdini in the project.
Here's what my svelte.config.js file looks like:
importadapterfrom'@sveltejs/adapter-auto'
importhoudinifrom'houdini-preprocess'
importpathfrom'path'
/** @type {import('@sveltejs/kit').Config} */
const config ={
preprocess:[houdini()],
kit:{
adapter:adapter(),
// hydrate the <div id="svelte"> element in src/app.html
target:'#svelte',
vite:{
resolve:{
alias:{
$houdini: path.resolve('.','$houdini'),
},
},
server:{
fs:{
// Allow serving files from one level up to the project root
// https://vitejs.dev/config/#server-fs-allow
allow:['..'],
},
},
},
},
}
exportdefault config
Add Houdini Client
Now to have the Houdini client available to the project, I'll need to add this to somewhere where it will be available to the whole project. The SvelteKit __layout file is a good place to add this.
I'll need to create the layout file, I'll do that with this bash one-liner:
touch src/routes/__layout.svelte
In the newly created __layout.svelte file, I'll add the following:
<scriptcontext="module">
import{ setEnvironment }from'$houdini'
importenvironmentfrom'../environment'
setEnvironment(environment)
</script>
<slot/>
Optional styling
I will just focus on how to use Houdini here, so I'll skip the styling. If you want to use Tailwind classes in the project, you can use the following to initialise the project to use Tailwind:
I'm going to define the first GraphQL query for use in the project. This is the standard information you'd want to display on a blog landing page.
I'll pop in a <pre> tag with the posts object returned from the Houdini query so I can see the data on the page as a quick way to validate it's working.
You may have noticed the $ on the data object, this is a Svelte store and the $ is how I can subscribe to it.
Now for Houdini to know about that query, I'll need to run the Houdini generate command:
npx houdini generate
This will throw an error, because Houdini needs to know how to handle the Date type:
npx houdini generate
AllPosts
Error: Could not convert scalar type: Date
There's a couple of issues on the Houdini GitHub repo detailing how to create a custom scalar type.
Here's what my houdini.config.js looks like now with the custom scalar added:
/** @type {import('houdini').ConfigFile} */
const config ={
schemaPath:'./schema.graphql',
sourceGlob:'src/**/*.svelte',
module:'esm',
framework:'kit',
scalars:{
// the name of the scalar we are configuring
Date:{
// the corresponding typescript type (what the typedef generator leaves behind in the response and operation inputs)
type:'Date',
// turn the api's response into that type
unmarshal(val){
const date =newDate(val).toISOString()
return date
},
// turn the value into something the API can use
marshal(date){
return date.getTime()
},
},
},
}
exportdefault config
If I try the Houdini generate command again, I'll get the following output:
npx houdini generate
AllPosts
Looks like there no issues there now!
As a side note here, I'll be adding in some more queries while building out this example, so what I'll do is add the npx houdini generate command to the project scripts.
This is so that I don't have to stop the dev server each time I add a new query to have Houdini generate the files needed.
Here's what the scripts look like in my package.json file now:
So the query for the post page will need to take a query parameter (slug) and use that to get the post.
The query will look something like this, I've taken out the author and cover image fields for brevity:
query PostQuery($slug: String!) {
post(where: { slug: $slug }) {
title
date
tags
content {
html
}
}
}
I can use that query much the same way I did it on the index page, following the same pattern.
<script>
import{ graphql, query }from'$houdini'
const{ data }=query(
graphql`
query PostQuery($slug: String!) {
post(where: { slug: $slug }) {
title
date
tags
# author
content {
html
}
# coverImage
}
}
`
)
const{ post }= $data
</script>
<pre>{JSON.stringify(post, null, 2)}</pre>
Here's where things get a bit specific to Houdini, as Houdini replaces the load function in SvelteKit with a Variables function. It takes the same arguments as the load function, so this is where I can destructure out the params object to get the slug that can be used in the query.
I'll add this to the top of the file:
<scriptcontext="module">
exportconstPostQueryVariables=({ params })=>{
const{ slug }= params
return{
slug,
}
}
</script>
One thing to note is that the Variables function will take on the name of the query defined, so on this file the query is PostQuery so the load function for the page needs to be PostQueryVariables.