GraphQL Yoga
By The Guild
js, Deno, Bun, and edge environments like Cloudflare Workers. It bundles commonly needed server features, such as subscriptions, file uploads, and error masking, out of the box rather than requiring separate plugin installation for each.
Definition
GraphQL Yoga is a fully featured, batteries-included GraphQL server library for JavaScript and TypeScript, built on the reference GraphQL.js execution engine and designed to run on any JavaScript runtime, including Node.js, Deno, Bun, and edge environments like Cloudflare Workers. It bundles commonly needed server features, such as subscriptions, file uploads, and error masking, out of the box rather than requiring separate plugin installation for each. It is maintained by The Guild, a team behind several widely used GraphQL tooling projects.
Overview
GraphQL Yoga was created to reduce the amount of manual assembly required to stand up a production-ready GraphQL server. Earlier approaches often required combining a base server like Express or Apollo Server with several separate plugins for subscriptions, file uploads, and CORS handling; Yoga instead ships those capabilities integrated by default, aiming for a server that works correctly out of the box for common use cases with minimal configuration. Mechanically, GraphQL Yoga wraps the official GraphQL.js execution engine and adds an HTTP layer implemented against the Fetch API standard rather than a specific runtime's request and response objects, which is what lets the same core run unmodified on Node.js, Deno, Bun, and edge platforms like Cloudflare Workers. It implements GraphQL subscriptions over Server-Sent Events, supports the GraphQL multipart request specification for file uploads, and includes an interactive GraphiQL interface for exploring a schema during development, all without additional packages. Within the GraphQL server landscape, Yoga's closest comparison is Apollo Server, which offers a similarly full-featured server but is built around Apollo's own ecosystem, including Apollo Studio and Apollo Client integration, and historically favored Node.js-specific APIs before adding broader runtime support. Mercurius takes a different approach again, building GraphQL support directly into the Fastify framework for maximum performance within that ecosystem. Yoga's Fetch-API-based, runtime-agnostic design gives it an edge for teams deploying to serverless or edge platforms where a Node.js-specific server would not run. In practice, GraphQL Yoga is used to build standalone GraphQL APIs, to add a GraphQL layer in front of existing REST services, and increasingly to deploy GraphQL servers to edge computing platforms where cold-start time and runtime compatibility with Fetch-based environments matter. Its plugin system, compatible with the broader Envelop plugin ecosystem also maintained by The Guild, lets teams add capabilities like caching or persisted queries without switching servers. The trade-off for Yoga's runtime portability and batteries-included defaults is that teams deeply invested in the Apollo ecosystem, particularly Apollo Studio for schema management and observability, may find switching away from Apollo Server introduces friction, since some of that tooling is tied specifically to Apollo's server and client libraries. Teams that do not need Apollo-specific tooling and value being able to deploy the same server code across multiple JavaScript runtimes generally find Yoga's design well suited to that goal. Yoga's smaller, community-driven ecosystem also means fewer managed hosting and observability integrations exist for it out of the box compared with Apollo's commercial offerings, so teams needing that level of managed tooling sometimes weigh it against Yoga's portability benefits before choosing.
Key Features
- Built on the reference GraphQL.js execution engine with a Fetch API-based HTTP layer
- Runs unmodified on Node.js, Deno, Bun, and edge runtimes like Cloudflare Workers
- Built-in GraphQL subscriptions support over Server-Sent Events
- Native support for multipart file upload requests
- Includes GraphiQL for interactive schema exploration during development
- Compatible with the Envelop plugin ecosystem for extending server behavior