Olivier Refalo
Olivier Refalo

Reputation: 51535

What is the difference between GraphQL-Mesh and Apollo-Federation?

What is the difference between GraphQL-Mesh and Apollo-Federation?

I see that mesh support federation, which is kind of confusion?

Is it just two different ways to achieve a unified schema?

Why would you pick one solution rather than the other?

Upvotes: 4

Views: 3475

Answers (3)

Kamil Kisiela
Kamil Kisiela

Reputation: 509

An important update to make this thread up to date.

The Guild took part of GraphQL Mesh and turned it into a GraphQL gateway called Hive Gateway - here's a blog post about it.

GraphQL Mesh is now using GraphQL Federation under the hood to compose different APIs (gRPC, OpenAPI, Swagger, databases etc.) into a Supergraph served by Hive Gateway.

Right now the difference between GraphQL Mesh and Apollo Federation is that GraphQL Mesh turns any API into GraphQL that can be served as Apollo Federation subgraph. In short, GraphQL Mesh extends Apollo Federation, it takes it to the next level.

Upvotes: 0

Eld0w
Eld0w

Reputation: 904

GraphQL Mesh is a set of tools to build either a gateway or a sdk for a set of data sources. They can be of various types : documented REST Apis, postgres databases through Postgraphile, of course GraphQL servers, and many more.

Mesh then allows you to perform transformations to alter your end schema.

Apollo Federation is a library designed to build relationships between separate GraphQL Schemas, also called sub graphs. It is also one of the transformation strategy proposed by GraphQL Mesh.

In a sense, GraphQL Mesh is more comparable to Apollo Gateway but with way more features to customize your schema and the ability to be used as a sdk.

Upvotes: 5

mpsido
mpsido

Reputation: 187

GraphQL-Mesh: connects to your database: detects the database schema and transform it into a GraphQL server. It is a sort of "zero code" solution. You have the database and bam!: you can query it as a graphql server.

Apollo: more difficult to summarize in one sentence it is both frontend and backend. It is not zero code solution: it is a fullstack framework that helps you write the code that will serve a proper GraphQL communication

  • on frontend side, it helps you write the graphql queries in your javascript code, (integrates well with React.js but can be used for other frontend libraries as well) it does also caching (so that the frontend does not ask the server again if the data is in his cache)
  • on backend side: you can declare a graphql schema and write the code for your resolvers (the resolvers are the function that are called when your backend receives a graphql query: they must return the expected data). Apollo takes care of listening for the queries, parsing them and call the proper resolver for every sub part of the query.

Upvotes: 1

Related Questions