What is the difference between Mesh, Federation, Hasura, and GraphQL Tools?
As stated in the introduction page, many approaches exist to build a GraphQL Gateway:
- creating an Apollo Server with Apollo DataSource to query sub-services
- creating a GraphQL Gateway from scratch using GraphQL tools (ex:
stitchSchemas()
) - use Apollo Federation
- use Hasura on top of a Postgres with custom Actions
The comparison table below evaluates all those solutions based on 3 criteria:
- How is the solution helping you build Unified Schema Gateway in a productive and maintainable way?
- Is the solution provides all the features to build a well-designed Unified GraphQL Schema? (comprehensive, simplified abstraction of a set of sub-services)
- Which sub services types the solution supports?
Productivity / Maintainability | Unified Schema design | Sub-services support | |
---|---|---|---|
GraphQL Mesh | 🟢 Packages with a server, caching, Envelop plugins, and large sub-service types support. Configuration-based with custom resolvers. | 🟢 Flexible Schema design with Transforms and custom resolvers support. | 🟢 Support for a large range of types of sub-service and databases. |
GraphQL Tools | 🟠 Programmatic approach at the Gateway level. Type merging makes it easier to deal with sub-services conflicts. | 🟢 Access to all GraphQL Schema building libraries. | 🟠 Only supports GraphQL sub-services out of the box. Other sub-service types can be supported with Schema extensions at the Gateway level. |
Apollo Server with DataSources | 🔴 Requires a lot of coding and maintenance work at the DataSources level. | 🟢 Access to all GraphQL Schema building libraries. | 🟠 Integrating with some type of sub-services might require some extra work. |
Apollo Federation | 🟢 Rover CLI and Apollo Studio. Only the Apollo Gateway needs maintenance. | 🟢 Access to all GraphQL Schema building libraries. | 🔴 Only supports "Federation compliant" GraphQL sub-services. |
Hasura | 🟢 Plug and play solution. Configuration-based with custom resolvers. | 🟠 The Unified Schema is directly linked to the underlying database schema or sub-services design. | 🟠 Only supports GraphQL and REST sub-services and, a set of databases. |