Unifying Internal APIs: A Different Use Case for GraphQL Gateways
trivago built an internal GraphQL gateway on GraphQL Mesh v0, embedded in a Node.js Express server, that stitches more than 15 upstream sources (OpenAPI services, MySQL databases, GraphQL servers) into one graph powering a unified admin tool. Upstream services stay untouched. The gateway stays thin, using filter and prefix transforms to avoid type collisions, role-based access via composer resolvers (moving toward directives), and an audit-logging pattern that appends a logAuditEvent mutation and checks actual response values against expected ones. Six years in, a flat, partly duplicated graph has proven fine for internal consumers, and integrating services surfaced undocumented data and overlapping systems. Hard parts include the breadth of expertise needed and mixing staging and production environments.
Related posts
- How we use GraphQL at Europe's largest fashion e-commerce company
Zalando Engineering easyNoviceZalando replaced a sprawl of per-page and per-platform Backend-for-Frontend services with a single unified GraphQL API owned via a shared monorepo across 12+ domain teams. The BFFs had duplicated effort, fragmented security and observability, and produced inconsistent data across web and app. The graph is built on Entities such as Product and Campaign and runs on their own GraphQL engine, graphql-jit, under a strict no-business-logic rule. Since 2018 it has grown to serve over 80% of web and 50% of app use cases, with adoption driven by documentation, training and schema consultation, and god-component risk handled through contribution principles, circuit breakers, timeouts, retries and per-platform bulkhead deployments.
- Optimize GraphQL Server with Lookaheads
Zalando Engineering mediumAdeptZalando's GraphQL server uses lookaheads on the resolver's info AST (fieldNodes and selection sets) to work out which sub-fields a query requests, then forwards them to backends that support partial responses via a fields parameter. Dependency maps translate schema fields to backend object paths for the request, and per-field transformer maps build the schema response from partial backend data without null-check sprawl. DataLoader batches product lookups across a query by merging ids and taking the union of requested backend fields, since most backends can't select different fields per id.
- Understanding GraphQL Directives: Practical Use-Cases at Zalando
Zalando Engineering mediumAdeptZalando uses custom GraphQL directives to declare cross-cutting server behavior in the schema and to attach client metadata in queries. Schema directives handle field-level authentication with ACR levels (@isAuthenticated), redacting sensitive arguments from logs and traces (@sensitive, backed by a keyword linter), restricting fields to dedicated HTTP endpoints for rate limiting and bot protection (@requireExplicitEndpoint), and gating persisted queries by schema stability (@draft, @allowedFor). They also control enum evolution for mobile clients (@final, @extensibleEnum) and generate entity ID boilerplate (@resolveEntityId). Query directives such as @component, @tracingTag and @omitErrorTag feed OpenTelemetry tracing and alerting, using a two-step AST extraction before execution and error-path matching after it.
- GraphQL persisted queries and Schema stability
Zalando Engineering mediumAdeptZalando disables arbitrary GraphQL queries in production and accepts only query IDs that were persisted at build time, where an ID is a hash of the normalized query. Because every production query is known, the team can monitor and alert per query and tell which schema fields are unused and therefore safe to break. On top of this they add schema directives: @draft blocks a field from being persisted so it can be merged, deployed and changed freely. @component and @allowedFor restrict an experimental field to specific UI components, so a breaking change only touches those callers. Fields move from draft to restricted to stable, which lets the schema evolve without long-lived feature branches across microservices.
- pg_graphql: A GraphQL extension for PostgreSQL
Supabase mediumAdeptpg_graphql is an open-source PostgreSQL extension, written in C and SQL, that reflects a GraphQL schema from existing tables and resolves queries entirely inside the database. Supabase built it because its 1 GB free-tier VMs had no memory left for a separate GraphQL process like Graphile or Hasura. Each GraphQL request is transpiled into a single SQL statement that aggregates results as JSON. This avoids N+1 queries, respects row level security, and gives multi-operation requests transactional semantics. Pagination follows the Relay connection spec using keyset pagination, the API is one SQL function (gql.resolve) exposed over HTTP via PostgREST, and a benchmark shows about 2,205 requests/second on a 4-core machine.