Hygraph
Docs

#Lesson 5 - Remote sources

This section covers connecting the e-commerce project to an external REST API and making its data queryable through the Hygraph API alongside native Hygraph content.

Without this section, the schema can only return data stored in Hygraph. After completing the lessons in this section, a single API call to Hygraph returns both Hygraph content and external review data. No separate API request is needed, and no data is migrated or duplicated.

The three lessons build on each other in sequence. The remote source must exist before adding remote fields. Remote fields must exist before the top-level remote field can be tested against real data.

By the end of lesson 5.3, the project schema includes:

  • A REST remote source connected to the Hygraph demo API (HyDemoAPI)
  • A remote field on the Product model that fetches reviews scoped to each product entry
  • A top-level remote field on the Query model that fetches reviews independently of any product entry

#Lessons in this section

LessonWhat you will do
5.1 Add a remote sourceConnect the HyDemoAPI REST endpoint to the project schema and define the custom types Hygraph needs to query it
5.2 Add remote fieldsAdd a remote field to the Product model to fetch review data scoped to each product entry
5.3 Add top-level remote fieldsAdd a top-level remote field to the Query model and run a test query to confirm the remote source is working

For the complete remote sources documentation, see Remote Sources.

#What's next

Lesson 5.1 - Add a remote source

Or, go to the Tutorial overview for the full lesson list.