Search code examples
apollo-federationgraphql-mesh

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?


Solution

  • 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.