Is ApolloGateway a must for federation?

Say I have two Graphql schemas from two different programming langauges(Rust and Elixir) and the frontend is using Relay.

Is it a must to use the ApolloGateway like showed here

Hello :waving_hand:

Yes you do need a federated Gateway/Router.

Federated GraphQL architecture exposes single GraphQL schema for your clients to interact with. As such, you do need a Gateway/Router to expose this single schema and handle incoming requests. Incoming requests have to be planned as we need to not only figure out where to send the request but we may also need to rewrite those queries as single client request may end up requesting data from a number of different subgraphs.

By having router in front of your subgraphs, you can also centralize some common concerns (e.g. auth, demand control, etc) in a single place.

Thanks,
Derek

Thank you very much. I think I have found what I need and it is Apollo Router. I THINK it is the equivalent to the JS version of ApolloGateway.

Do you happen to know how I can use Router to encapsulate mulitple graphql endpoints? The documentation is mainly focused on using it as a binary but not a Rust library.

How could I accomplish the following in Rust with the Router?


const END_POINT_A: &str = "http://localhost:4000/graphql";
const END_POINT_B: &str = "http://localhost:4001/graphql";

// Imaingary functions, the router takes two endpoints and now serve requests
ApolloRouter
::endpoints([
   END_POINT_A,
   END_POINT_B,
])
.serve()
.await;

Yes Apollo Router (RS) is the high performance replacement for Apollo Gateway (JS).

Do you happen to know how I can use Router to encapsulate mulitple graphql endpoints? The documentation is mainly focused on using it as a binary but not a Rust library.

Router is distributed only as a binary.

You provide this information in router configuration file (see the docs that you linked). Information about the subgraphs and their endpoints is embedded in the supergraph schema (defaults can be overridden in router config file if needed as well).