Does Apollo Router replace my API gateway?
How the Apollo Router differs from API gateways
The
The key distinction of the router is that is not based on URLs or REST endpoints. The router is a GraphQL-native solution to handle your clients API operations.
💡 TIP
Apollo GraphQL and Kong have partnered to produce a joint paper that provides API practitioners with the tools they need to navigate the complex API landscape and drive successful digital experiences. Read more in the
GraphQL native
First, let's define what we mean by "GraphQL native." Apollo Router runs all the client operations against a
type Query {bankAccounts: [BankAccount] @authenticated @hasRole(role: ADMIN)}
API gateways (like Apigee, Mulesoft, or ones from AWS, Azure, or Google Cloud) usually have little understanding of all the services underneath them or what their capabilities are. They may have configuration options and rules that can apply to those services, but these are blanket rules that must be configured at the gateway level, not at the service definition. If you wanted to apply a common rule across many services it would be up to the API gateway managers to configure, deploy, and apply that new rule to a set of services rather than the individual service teams.
# Mock gateway rulesgatewayConfig:myCustomRule:tags: [requiresAuth]ruleToApply: validate-jwt-pluginmyOtherCustomRule:URL: '/accounts'ruleToApply: requires-admin-permissions-plugin
Support for non-GraphQL APIs
GraphQL is an innovative technology that give clients much more control over their operations and a common language for service teams to communicate. However, GraphQL usually is not the one and only API technology used by companies today.
If you need to have a common gateway to secure REST endpoints and GraphQL endpoints, the Apollo Router can be a complimentary tool that lives underneath this higher-level API gateway. You can configure company-wide policies at the outermost edge layer, and anything else that is better defined as a GraphQL-specific policy can be managed by the router.
In addition, using a
When to consider Apollo Router
If you are running a GraphQL API in production, and you want to be able to:
- Monitor your GraphQL operationsin a way that other telemetry tools don't support whilecontinuing support for existing APM tools
- Safely publish new schemas without introducing a breaking change
- Secure your GraphQL schema
- Extend the GraphQL runtime with custom features
And do all this with