# graphql-yoga

Latest version **5.24.1** (published 2026-09-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install graphql-yoga
pnpm add graphql-yoga
yarn add graphql-yoga
bun add graphql-yoga
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 5.24.1 |
| Published | 2026-09-17 |
| First published | 2017-11-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18.0.0 |
| Dependencies | 12 |
| Unpacked size | 301.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 8529 |
| Author | Saihajpreet Singh <saihajpreet.singh@gmail.com> (https://saihaj.dev/) |
| Maintainers | dotansimha, theguild-bot |
| Keywords | graphql, server, api, graphql-server |

## Links

- npm: https://www.npmjs.com/package/graphql-yoga
- Repository: https://github.com/graphql-hive/graphql-yoga
- Homepage: https://github.com/graphql-hive/graphql-yoga/tree/main/packages/graphql-yoga#readme
- npm.io page: https://npm.io/package/graphql-yoga

## Dependencies (12)

- [tslib](https://npm.io/package/tslib.md) ^2.8.1
- [lru-cache](https://npm.io/package/lru-cache.md) ^10.0.0
- [@envelop/core](https://npm.io/package/@envelop/core.md) ^5.6.1
- [@whatwg-node/fetch](https://npm.io/package/@whatwg-node/fetch.md) ^0.10.6
- [@whatwg-node/server](https://npm.io/package/@whatwg-node/server.md) ^0.11.0
- [@graphql-tools/utils](https://npm.io/package/@graphql-tools/utils.md) ^11.2.0
- [@graphql-yoga/logger](https://npm.io/package/@graphql-yoga/logger.md) ^2.0.2
- [@graphql-tools/schema](https://npm.io/package/@graphql-tools/schema.md) ^10.0.11
- [@graphql-tools/executor](https://npm.io/package/@graphql-tools/executor.md) ^2.0.0
- [@envelop/instrumentation](https://npm.io/package/@envelop/instrumentation.md) ^1.0.1
- [@graphql-yoga/subscription](https://npm.io/package/@graphql-yoga/subscription.md) ^5.1.1
- [@whatwg-node/promise-helpers](https://npm.io/package/@whatwg-node/promise-helpers.md) ^1.3.2

## Alternatives

- [apollo-link-http-common](https://npm.io/package/apollo-link-http-common.md) — 879.0K weekly downloads
- [react-relay](https://npm.io/package/react-relay.md) — 336.8K weekly downloads
- [relay-test-utils](https://npm.io/package/relay-test-utils.md) — 181.6K weekly downloads
- [@vendure/core](https://npm.io/package/@vendure/core.md) — 14.8K weekly downloads
- [@pnpm/deps.graph-sequencer](https://npm.io/package/@pnpm/deps.graph-sequencer.md) — 13.4K weekly downloads

## Recent versions

- 5.24.1 (latest) — 2026-09-17
- 5.24.2-alpha-20260923105446-2f6cb77c62aeb06a87de9d00b2889e7ff790cda0 (alpha) — 2026-09-23
- 5.4.0-rc-20240603095956-b14bcd26 (rc) — 2024-06-03
- 3.0.0-next.12 (three) — 2022-11-11
- 2.13.7-canary-4a8cc11.0 (canary) — 2022-08-16
- 2.0.0-beta.8 (beta) — 2022-03-28
- 5.24.0 — 2026-09-16
- 5.23.0 — 2026-09-11
- 5.22.1-alpha-20260908182732-ad6835db515b61d9f8f0a4a65b9c913eec461d0d — 2026-09-08
- 5.22.1-alpha-20260907213241-78f82fc384c406e500f4db0b9b6b6e447ac378fc — 2026-09-07
- 5.22.0 — 2026-08-19
- 5.21.3 — 2026-08-13
- 5.21.3-alpha-20260813061610-f46f0da54fe7b497cdb77440500affe42dbdd589 — 2026-08-13
- 5.21.3-alpha-20260812162438-3b41bea058f9f2267857ac0589751ea29cebd67e — 2026-08-12
- 5.21.3-alpha-20260812162143-a1a40895d53b9b8e54e0c0135db91bde53413f05 — 2026-08-12
- … 4485 more at https://npm.io/package/graphql-yoga/versions

## README

<div align="center"><img src="https://raw.githubusercontent.com/graphql-hive/graphql-yoga/refs/heads/main/website/assets/cover.png" width="720" /></div>

<div align="center">
  <h3>GraphQL Yoga</h3>
  <h6>Fully-featured GraphQL Server with focus on easy setup, performance & great developer experience</h6>
  <a href="https://www.the-guild.dev/graphql/yoga-server/docs"><b>Go to documentation</b></a>
</div>

<br />

<div align="center">

![npm](https://badgen.net/npm/v/graphql-yoga)
![bundlephobia minified size](https://badgen.net/bundlephobia/min/graphql-yoga)
![bundlephobia minified+zipped size](https://badgen.net/bundlephobia/minzip/graphql-yoga)
![bundlephobia treeshaking](https://badgen.net/bundlephobia/tree-shaking/graphql-yoga)
![license](https://badgen.net/github/license/graphql-hive/graphql-yoga)

</div>

## Quick start

### Install

```sh
pnpm add graphql-yoga graphql
```

### Start

Make a schema, create Yoga and start a Node server:

```ts
import { createServer } from 'node:http'
import { createSchema, createYoga } from 'graphql-yoga'

const yoga = createYoga({
  schema: createSchema({
    typeDefs: /* GraphQL */ `
      type Query {
        hello: String
      }
    `,
    resolvers: {
      Query: {
        hello: () => 'Hello from Yoga!'
      }
    }
  })
})

const server = createServer(yoga)

server.listen(4000, () => {
  console.info('Server is running on http://localhost:4000/graphql')
})
```

## Overview

- **Easiest way to run a GraphQL server:** Sensible defaults & includes everything you need with
  minimal setup (we also export a platform/env-agnostic handler so you can build your own wrappers
  easily).
- **Includes Subscriptions:** Built-in support for GraphQL subscriptions using
  [**S**erver-**S**ent **E**vents](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events).
- **Compatible:** Works with all GraphQL clients
  ([Apollo](https://www.apollographql.com/docs/react/), [Relay](https://relay.dev/),
  [Urql](https://formidable.com/open-source/urql/)...) and fits seamless in your GraphQL workflow.
- **WHATWG Fetch API:** the core package depends on
  [WHATWG Fetch API](https://fetch.spec.whatwg.org/) so it can run and deploy on any environment
  (Serverless, Workers, Deno, Node).
- **Easily Extendable:** New GraphQL-Yoga support all [`envelop`](https://www.envelop.dev) plugins.

## [Features](https://www.the-guild.dev/graphql/yoga-server/docs)

- Fully typed with [TypeScript](https://www.typescriptlang.org)
- [GraphQL over HTTP spec compliant](https://github.com/enisdenjo/graphql-http/tree/master/implementations/graphql-yoga)
- [GraphiQL included](https://www.the-guild.dev/graphql/yoga-server/docs/features/graphiql)
- [File uploads with GraphQL Multipart Request spec](https://www.the-guild.dev/graphql/yoga-server/docs/features/file-uploads)
- [Subscriptions and realtime capabilities](https://www.the-guild.dev/graphql/yoga-server/docs/features/subscriptions)
- [Automatic persisted queries](https://www.the-guild.dev/graphql/yoga-server/docs/features/automatic-persisted-queries)
- [Built-in parsing and validation caching](https://www.the-guild.dev/graphql/yoga-server/docs/features/parsing-and-validation-caching)
- [Testing utilities](https://www.the-guild.dev/graphql/yoga-server/docs/features/testing)
- Supports [ESM](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules)
- Runs **everywhere**, including environments like:
  - [Deno](https://www.the-guild.dev/graphql/yoga-server/docs/integrations/integration-with-deno)
  - [Bun](https://www.the-guild.dev/graphql/yoga-server/docs/integrations/integration-with-bun)
  - [Cloudflare Workers](https://www.the-guild.dev/graphql/yoga-server/docs/integrations/integration-with-cloudflare-workers)
  - [AWS Lambda](https://www.the-guild.dev/graphql/yoga-server/docs/integrations/integration-with-aws-lambda)
  - [_And other..._](https://www.the-guild.dev/graphql/yoga-server/docs/integrations/z-other-environments)
- [_And more..._](https://www.the-guild.dev/graphql/yoga-server/docs)

## [Documentation](https://www.the-guild.dev/graphql/yoga-server/docs)

Our [documentation website](https://www.the-guild.dev/graphql/yoga-server/docs) will help you get
started.

## [Examples](https://github.com/graphql-hive/graphql-yoga/tree/main/examples)

We've made sure developers can quickly start with GraphQL Yoga by providing a comprehensive set of
examples.
[See all of them in the `examples/` folder.](https://github.com/graphql-hive/graphql-yoga/tree/main/examples)

## [Comparison](https://www.the-guild.dev/graphql/yoga-server/docs/comparison)

Read more about how GraphQL Yoga compares to other servers in the ecosystem
[here](https://www.the-guild.dev/graphql/yoga-server/docs/comparison).

## Contributing

If this is your first time contributing to this project, please do read our
[Contributor Workflow Guide](https://github.com/the-guild-org/Stack/blob/master/CONTRIBUTING.md)
before you get started off.

For this project in particular, to get started on `stage/2-failing-test`:

1. Install [Node.js](https://nodejs.org/)
2. Run in your terminal: `npm i -g pnpm@8 && pnpm install && pnpm build`
3. Add tests to `packages/graphql-yoga/__tests__` using [Jest](https://jestjs.io/docs/api) APIs
4. Run the tests with `pnpm test`

Feel free to open issues and pull requests. We're always welcome support from the community.

## Code of Conduct

Help us keep Yoga open and inclusive. Please read and follow our
[Code of Conduct](https://github.com/the-guild-org/Stack/blob/master/CODE_OF_CONDUCT.md) as adopted
from [Contributor Covenant](https://www.contributor-covenant.org/).

## License

MIT

---
_Source: https://npm.io/package/graphql-yoga · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
