graphql-yoga
GraphQL Yoga is a batteries-included, fully-featured GraphQL server built on top of the Fetch API standard, making it compatible with any JavaScript runtime inc…
Installation
npm install graphql-yoga graphql
yarn add graphql-yoga graphql
pnpm add graphql-yoga graphql
Import
import { createYoga, createSchema } from 'graphql-yoga';Quick Example
import { createYoga, createSchema } from 'graphql-yoga';
import { createServer } from 'http';
const yoga = createYoga({
schema: createSchema({
typeDefs: `type Query { hello: String }`,
resolvers: { Query: { hello: () => 'Hello' } },
}),
});
createServer(yoga).listen(4000);About graphql-yoga
GraphQL Yoga is a batteries-included, fully-featured GraphQL server built on top of the Fetch API standard, making it compatible with any JavaScript runtime including Node.js, Deno, Bun, Cloudflare Workers, and AWS Lambda. Developed by The Guild, GraphQL Yoga provides a simple yet powerful API for building GraphQL servers with sensible defaults that can be customized through an extensible plugin system based on the Envelop plugin framework. The server includes built-in support for file uploads, subscriptions (WebSocket and Server-Sent Events), response caching, CORS configuration, error masking for production, and GraphiQL for interactive query development. GraphQL Yoga integrates seamlessly with popular schema-building tools including Pothos, Nexus, TypeGraphQL, and SDL-first approaches. The plugin system allows adding functionality like authentication, rate limiting, query depth limiting, and APM integration through a composable middleware architecture. GraphQL Yoga handles multipart request parsing for file uploads natively and supports @defer and @stream for incremental delivery. It is positioned as a simpler, more standards-compliant alternative to Apollo Server.
Quick Facts
| Package | graphql-yoga |
| Category | HTTP |
| Weekly Downloads | 300K+ |
| License | MIT |
| Install | npm install graphql-yoga graphql |
Related Packages
GraphQL is the JavaScript reference implementation of the GraphQL specification, a query language fo…
Apollo Server is the most popular GraphQL server implementation for Node.js, providing a production-…
tRPC enables you to build fully typesafe APIs without schemas or code generation by leveraging TypeS…
Express is the most widely used web application framework for Node.js, providing a minimal and flexi…
Browse npm Packages by Category
Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.