Skip to main content
Version: v2.x

Apollo Federation Support

Introduction

Hasura GraphQL Engine supports the Apollo Federation v1 spec, so you can add Hasura as a subgraph in your Apollo federated gateway. You can also use Hasura generated table types in your other subgraphs by enabling tables for Apollo Federation explicitly.

Experimental

Apollo Federation is an experimental feature and can be enabled by adding apollo_federation to the HASURA_GRAPHQL_EXPERIMENTAL_FEATURES environment variable array or with the server flag --experimental-feature.

Supported from

Apollo Federation is available from Hasura version v2.10.0 and above.

Using Hasura tables in other subgraphs

Currently, only the types generated for the database source tables can be extended in other subgraphs. The primary key will be used in the @key directive's fields argument. For example, enabling the table user for Apollo Federation will generate the type user as follows:

type user @key(fields: "id") {
id: Int!
name: String
...
}

The Apollo Federation support in Hasura only allows extending other subgraphs with Hasura types. The other way i.e. extending Hasura types with other subgraphs is not possible currently. We recommend using remote relationships for extending types from other subgraphs in Hasura.

Note

Other types such as action types, Remote Schema types, etc. cannot be extended to other subgraphs.

Head to the Data -> [table-name] -> Modify tab in the Console and toggle the switch in the Enable Apollo Federation section:

Set table as enum