Easily restore your project to a previous version with our new Instant One-click Backup Recovery
Hygraph
Docs

Remote data overview

#Overview

remote-sources-mainscreen.pngremote-sources-mainscreen.png

A Remote Source is a custom resolver entry point for your schema that allows data to be sourced from an external third-party web service and accept field values from other Hygraph fields as arguments.

With Remote Sources, our Content Federation utility, it's possible to add content from other systems and sources to the Hygraph API without having to migrate the content itself.

You can use Remote Sources to add Remote Fields to your schema, at the model or at the top level:

At the model level, you can use them to enrich data, which can then be queried in the context of the model they are a part of.

At the top level, you can use them to fetch remote data - unrelated to Hygraph - that can be consumed by your frontend alongside your Hygraph data.

#What you can do

Remote Sources enable teams to build optimized, data-rich applications where they can use existing services paired with new microservices to build user-friendly applications with a single content entry point.

There are many use cases where moving content into the CMS isn't possible or desirable. Examples include content for which there is a different system of record (e-commerce/product data like price or availability, content from a different vendor like Github or IMDBT, etc) and content that is stored in legacy systems that can't be easily migrated.

Remote Sources allow customers to create a single GraphQL API with content from all these different sources, providing flexibility for front-end developers and downstream applications.

#Important concepts

#Remote Source

A system or product that holds content that needs to be combined with content in Hygraph and which can be queried through a RESTful or GraphQL API. A single Remote Source can have different types of content (e.g., an e-commerce system might have products, categories, prices, etc). Every Remote Source has a unique (base) URL, such as Github, Shopify, Hasura, or a custom backend application.

#Remote content

These are fields that you can add to a model to fetch data from a Remote Source. There are two types: Remote Fields and Top-level Remote Fields.

#Remote Field

A field inside a Hygraph model that connects specific remote data to an entry of that model. Remote Fields are always related to a single Remote Source and a single custom type. RESTful Remote Fields are configured with a path to a specific endpoint in the Remote Source, such as user details from Github, or price & availability from Shopify.

#Top Level Remote Field

A field inside the Query system model in Hygraph. These fields are used to fetch remote data outside the context of a regular model, which is then sent to your frontend alongside your Hygraph data. This Content Federation utility eliminates the need to make separate API requests for data inside & outside of Hygraph.

#Custom Type

A GraphQL type that is used for content coming from a Remote Source. The custom types are combined with the auto-generated types inside Hygraph to create a single schema for content inside Hygraph and in the Remote Source. For RESTful Remote Sources, custom types need to be defined explicitly using SDL for all URL paths that will be queried in the Remote Source. For GraphQL Remote Sources, the custom types are auto-generated by using introspection on the Remote Source.

#Custom Input type

A specific kind of GraphQL type which is used to define input parameters for queries to Remote Sources.