Frequently Asked Questions

Product Information

What is Hygraph?

Hygraph is a GraphQL-native headless content management system (CMS) designed to unify data and enable content federation. It empowers businesses to create impactful digital experiences by removing traditional content management pain points and offering scalability, flexibility, and efficient data querying. Learn more.

What is the primary purpose of Hygraph?

The primary purpose of Hygraph is to unify data and enable content federation, allowing businesses to create impactful digital experiences. Its GraphQL-native architecture removes traditional CMS pain points and supports modern, scalable digital projects. Source.

Who is the target audience for Hygraph?

Hygraph is designed for developers, IT decision-makers, content creators, project/program managers, agencies, solution partners, and technology partners. It is especially beneficial for modern software companies, enterprises looking to modernize their tech stack, and brands aiming to scale across geographies or re-platform from traditional solutions. Source.

What are the key capabilities and benefits of Hygraph?

Hygraph offers 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.

Does Hygraph provide an API?

Yes, Hygraph provides a powerful GraphQL API that allows you to fetch and manage content efficiently. API Reference.

Features & Capabilities

What features does Hygraph offer?

Hygraph offers features such as GraphQL-native content management, content federation, scalability, robust integrations, enterprise-grade security, and an intuitive user interface. It supports rapid content delivery, localization, digital asset management, and more. Full feature list.

What integrations are available with Hygraph?

Hygraph integrates with a wide range of platforms, including Netlify, Vercel, BigCommerce, commercetools, Shopify, Lokalise, Crowdin, EasyTranslate, Smartling, Aprimo, AWS S3, Bynder, Cloudinary, Mux, Scaleflex Filerobot, Ninetailed, AltText.ai, Adminix, and Plasmic. See all integrations.

How does Hygraph ensure optimized content delivery performance?

Hygraph is optimized for rapid content delivery, which improves user experience, engagement, and search engine rankings. Fast content distribution reduces bounce rates and increases conversions. Learn more.

What security and compliance certifications does Hygraph have?

Hygraph is SOC 2 Type 2 compliant, ISO 27001 certified, and GDPR compliant. It offers SSO integrations, audit logs, encryption at rest and in transit, and sandbox environments to protect sensitive data. Security features.

Is Hygraph easy to use for non-technical users?

Yes, customers have praised Hygraph for its intuitive and user-friendly interface. Feedback includes comments like "super easy to set up and use" and "even non-technical users can start using it right away." Source.

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. See pricing details.

Use Cases & Benefits

What problems does Hygraph solve?

Hygraph addresses operational pains (like reliance on developers for content updates, outdated tech stacks, and clunky content creation), financial pains (high operational costs, slow speed-to-market, expensive maintenance, and scalability challenges), and technical pains (boilerplate code, overwhelming queries, evolving schemas, cache problems, and OpenID integration challenges). Learn more.

How does Hygraph solve pain points for different personas?

For developers, Hygraph reduces boilerplate code and streamlines query management. For content creators and project managers, it offers an intuitive interface for independent content updates. For business stakeholders, it lowers operational costs, supports scalability, and accelerates speed-to-market. Source.

What business impact can customers expect from using Hygraph?

Customers can expect significant time savings, faster speed-to-market, enhanced customer experience, and improved operational efficiency. For example, Komax achieved a 3X faster time to market, and Autoweb saw a 20% increase in website monetization. See customer stories.

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. See case studies.

What industries does Hygraph serve?

Hygraph serves industries including food and beverage, consumer electronics, automotive, healthcare, travel and hospitality, media and publishing, eCommerce, SaaS, marketplace, education technology, and wellness and fitness. See industry case studies.

Can you share specific customer success stories with Hygraph?

Yes. Komax achieved a 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. Explore more stories.

Technical Requirements & Developer Experience

How easy is it to get started with Hygraph?

Getting started with Hygraph is straightforward. You can sign up for a free-forever account, and resources like documentation, video tutorials, and onboarding guides are available. For example, Top Villas launched a new project in just 2 months. Documentation.

What technical documentation is available for Hygraph?

Hygraph provides comprehensive technical documentation covering all aspects of building and deploying projects. Access documentation.

What KPIs and metrics are associated with the pain points Hygraph solves?

Key metrics include time saved on content updates, system uptime, content consistency across regions, user satisfaction scores, reduction in operational costs, time to market, maintenance costs, and scalability metrics. Read more on KPIs.

Support & Implementation

What customer support is available after purchasing Hygraph?

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. Contact support.

What training and onboarding resources does Hygraph provide?

Hygraph provides onboarding sessions for enterprise customers, 24/7 support, training resources such as video tutorials, documentation, webinars, and access to Customer Success Managers for expert guidance. Learn more.

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 detailed documentation and the community Slack channel. Support details.

Developer Experience: Svelte & TypeScript

Does SvelteKit support TypeScript?

Yes, SvelteKit supports TypeScript. You can find more details in this blog post.

What are the benefits of using TypeScript with Svelte?

Using TypeScript with Svelte provides type safety and improved developer experience, making it easier to catch errors early and write maintainable code. Source.

Where can I find information about SvelteKit's TypeScript support?

You can find information about SvelteKit's TypeScript support at this link.

Resources & Community

Where can I find the Hygraph blog?

You can visit the Hygraph Blog for the latest updates, developer tutorials, and essential guides to content modeling.

What kind of content can I find in the Hygraph Blog?

The Hygraph Blog includes developer tutorials, product updates, and essential guides to content modeling. Explore the blog.

Webinar Event: How to Avoid Personalization Tech Traps

How to Use TypeScript with Svelte

In this post, we’ll explore getting set up with TypeScript in a SvelteKit project.
Scott Spence

Written by Scott 

Sep 20, 2022
svelte typescript

But first, why would you use TypeScript in a project? TypeScript is a typed superset of JavaScript that compiles it down to JavaScript.

As the name implies, TypeScript allows for type safety in your code, TypeScript doesn't stop you from writing bugs, though, it helps with identifying type errors. You can still write logical errors, like:

function add(a: number, b: number) {
return a - b
}

But it does allow you to catch type errors at compile time rather than run-time, let’s check out the TypeScript example from the last example and remove the types and correct the logic error, without the type safety of TypeScript we can add anything to the function and JavaScript thanks to type coercion will run it:

function add(a, b) {
return a + b
}
add(“yo”, “you”)
// result yoyou

This will be two projects:

  1. Example using graphql-request

    • Generate types with GraphQL code gen
    • How to use the types with SvelteKit
    • Store data locally in a Svelte store

2.Same as the basic example but using KitQL

  • It does all the other points for you!

To follow along with this post, you’ll need the following:

  • A SvelteKit project npm init svelte to scaffold out a new project or node.new/sveltekit in a browser
  • A GraphQL endpoint to query against, you can get started with this Graphflix project if you want

#Using graphql-request

Start by installing the dependencies for graphql-request and graphql

pnpm i graphql-request graphql

Then install the GraphQL code gen packages as developer dependencies with your package manager of choice, I’ll be using pnpm in the examples you can use npm or yarn if you please.

pnpm i -D @graphql-codegen/cli @graphql-codegen/typescript @graphql-codegen/typescript-operations @graphql-codegen/typed-document-node @graphql-typed-document-node/core

Once the dependencies are installed create a codegen.yml file at the root of the project:

schema: <https://api-eu.hygraph.com/v2/project-id/master>
documents:
- '**/*.{graphql,gql}'
generates:
src/lib/graphql/types.ts:
plugins:
- typescript
- typescript-operations
- typed-document-node

The codegen.yml file is telling the GraphQL code generator to generate the types.ts file in the src/lib/graphql folder. It will run the typescript, typescript-operations, and typed-document-node against the schema for anything matching the documents matching **/*.{graphql.gql}.

Create a GraphQL query, this can be at the root of the project or in a file structure that makes sense to you, as the types.ts file is being output to src/lib/graphql In the examples I’ll create the file in there so it’s co-located with the types.

Create a simple query to get all the episodes from your Graphlix API endpoint.

query GetEpisodes {
episodes {
title
length
video {
id
}
actors {
name
}
show {
title
}
}
}

Create a script in the package.json to run graphql-codegen:

"generate": "graphql-codegen",

Run the generate script:

pnpm run generate

Now check out the generated file, this will contain GetEpisodesDocument which can be used in a graphql-request client instead of a GraphQL query.

In the src/routes/index.svelte to validate the types create a call to the GraphQL endpoint by creating a new graphql-request client.

Note: This can be abstracted out into a shadow endpoint, for demonstration purposes, all the code is co-located.

<script context="module" lang="ts">
import {
GetEpisodesDocument,
type Episode,
type GetEpisodesQuery,
type GetEpisodesQueryVariables,
} from '$lib/graphql/types'
import { GraphQLClient } from 'graphql-request'
export const load = async () => {
const client = new GraphQLClient(
'<https://api-eu.hygraph.com/v2/project-id/master>'
)
const { episodes } = await client.request<
GetEpisodesQuery,
GetEpisodesQueryVariables
>(GetEpisodesDocument)
return {
props: {
episodes,
},
}
}
</script>
<script lang="ts">
export let episodes: Episode[]
</script>
<pre>{JSON.stringify(episodes, null, 2)}</pre>

With the client, you can use the TypeScript generic <> passing in the GetEpisodesQuery and the GetEpisodesQueryVariables, for the client query. There’s no need to enter a GraphQL in template literals, and can instead use the type document node of GetEpisodesDocument.

Taking this a step further, the data queried from the endpoint can be stored locally, so there are not as many round trips to the endpoint for the data.

This can be done by utilizing Svelte stores, a Svelte store is a writable object with subscribe method that will allow any part of the project to get updated data when the store is updated.

Create a Svelte stores folder in src, then in the folder, create an episodes.ts file, in the file, add the following:

import type { GetEpisodesQuery } from '$lib/graphql/types'
import { writable } from 'svelte/store'
export const episodesStore = writable(
[] as GetEpisodesQuery['episodes']
)

This creates a Svelte writable, exported as episodeStore, and assigns the type of episodes in the GetEpisodesQuery type from the GraphQL Code Generator types file.

In the load function of the src/routes/index.svelte file change the load function to update the episodeStore. There’s now no need to return the props for the page to use as the episodesStore can be used to access the data.

export const load = async () => {
const client = new GraphQLClient(
'<https://api-eu.hygraph.com/v2/project-id/master>'
)
const { episodes } = await client.request<
GetEpisodesQuery,
GetEpisodesQueryVariables
>(GetEpisodesDocument)
episodesStore.set(episodes)
return {}
}

In the body of the index page now, there are no props being imported; instead, the episodesStore is being accessed with the $ subscribing to any changes.

<script lang="ts">
// export let episodes: Episode[];
</script>
<pre>{JSON.stringify($episodesStore, null, 2)}</pre>

The data doesn’t need to be loaded on route changes and can be accessed on the store with the $ to subscribe for changes.

#Using KitQL

Ok, now to KitQL, which is a set of tools to help build in an efficient and fast way. KitQL comes with a lot of the previous GraphQL Code Generator plugins. To get set up, scaffold a new SvelteKit project with the npm init svelte command.

Install dependencies:

pnpm @kitql/all-in graphql

Then create a .graphqlrc.yaml file at the root of the project and add the following config:

projects:
default:
schema: '<https://api-eu.hygraph.com/v2/project-id/master>'
documents:
- '**/*.{graphql,gql}'
extensions:
endpoints:
default:
url: '<https://api-eu.hygraph.com/v2/project-id/master>'
codegen:
generates:
./src/lib/graphql/_kitql/graphqlTypes.ts:
plugins:
- typescript
- typescript-operations
- typed-document-node
- typescript-document-nodes
./src/lib/graphql/_kitql/graphqlStores.ts:
plugins:
- '@kitql/graphql-codegen'
config:
importBaseTypesFrom: $lib/graphql/_kitql/graphqlTypes
config:
useTypeImports: true

You can see from the codegen config here that it is very similar to the graphql-request example in the previous section.

This time around, in the package.json scripts, add a config for the .graphqlrc.yaml file:

"generate": "graphql-codegen --config ./.graphqlrc.yaml",

Now creating the same query as in the previous example to query for the episodes in the Hygraph Graphflix API so the generate script can pick it up and run the plugins against it.

query GetEpisodes {
episodes {
title
length
video {
id
}
actors {
name
}
show {
title
}
}
}

The file can go in the project's root for now, as running the generated script will create the folder structure when it’s run. It can then be moved into the src/lib/graphql folder.

Now the folder structure has been generated add a kitQLClient.ts file to /src/lib/graphql and add the following config:

import { KitQLClient } from '@kitql/client'
export const kitQLClient = new KitQLClient({
url: '<https://api-eu.hygraph.com/v2/project-id/master>',
credentials: 'omit',
headersContentType: 'application/json',
logType: ['client', 'server', 'operationAndvariables'],
})
Now in the src/routes/index.svelte file add the following:
<script context="module" lang="ts">
import { KQL_GetEpisodes } from '$lib/graphql/_kitql/graphqlStores'
export const load = async ({ fetch }) => {
await KQL_GetEpisodes.queryLoad({ fetch })
return {}
}
</script>
<script lang="ts">
let episodes = $KQL_GetEpisodes.data?.episodes
</script>
<pre>{JSON.stringify(episodes, null, 2)}</pre>

KitQL will generate all the stores and types needed for the get episodes query. In the example, you can see that an episodes variables were created but the KitQL store can be used inline and use the store directly:

<pre>{JSON.stringify($KQL_GetEpisodes.data?.episodes, null, 2)}</pre>

That’s it, we’ve gone through a couple of ways to use TypeScript with GraphQL in your SvelteKit projects.

Blog Author

Scott Spence

Scott Spence

Developer Advocate @Hygraph • Learner of things • Jamstack • Svelte

Share with others

Sign up for our newsletter!

Be the first to know about releases and industry news and insights.