MCPcopy Index your code
hub / github.com/graphql-hive/graphql-yoga

github.com/graphql-hive/graphql-yoga @release-1782317638369 sqlite

repository ↗ · DeepWiki ↗ · release release-1782317638369 ↗
1,547 symbols 5,020 edges 602 files 20 documented · 1%
README

GraphQL Yoga

Fully-featured GraphQL Server with focus on easy setup, performance & great developer experience

Go to documentation

npm bundlephobia minified size bundlephobia minified+zipped size bundlephobia treeshaking license

Quick start

Install

pnpm add graphql-yoga graphql

Start

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

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 Server-Sent Events.
  • Compatible: Works with all GraphQL clients (Apollo, Relay, Urql...) and fits seamless in your GraphQL workflow.
  • WHATWG Fetch API: the core package depends on WHATWG Fetch API so it can run and deploy on any environment (Serverless, Workers, Deno, Node).
  • Easily Extendable: New GraphQL-Yoga support all envelop plugins.

Features

Documentation

Our documentation website will help you get started.

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.

Comparison

Read more about how GraphQL Yoga compares to other servers in the ecosystem here.

Contributing

If this is your first time contributing to this project, please do read our Contributor Workflow Guide before you get started off.

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

  1. Install Node.js
  2. Run in your terminal: npm i -g pnpm@8 && pnpm install && pnpm build
  3. Add tests to packages/graphql-yoga/__tests__ using Jest 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 as adopted from Contributor Covenant.

License

MIT

Extension points exported contracts — how you extend this code

PersistedOperationsStore (Interface)
(no doc) [6 implementers]
packages/envelop/plugins/persisted-operations/src/types.ts
ResponseNamePath (Interface)
(no doc) [4 implementers]
packages/plugins/apollo-usage-report/src/stats.ts
OnExecutionResultEventPayload (Interface)
(no doc) [1 implementers]
packages/graphql-yoga/src/plugins/types.ts
ApolloSandboxOptions (Interface)
(no doc)
packages/render-apollo-sandbox/src/index.ts
TypedEventListener (Interface)
(no doc)
packages/event-target/typed-event-target/src/index.ts
Generator (Interface)
(no doc)
packages/nestjs/__tests__/utils/pubsub.ts
YogaGatewayDriverConfig (Interface)
(no doc)
packages/nestjs-federation/src/index.ts
Proc (Interface)
(no doc)
examples/nextjs-app/__integration-tests__/utils.ts

Core symbols most depended-on inside this repo

createTestkit
called by 346
packages/envelop/testing/src/index.ts
createYoga
called by 319
packages/graphql-yoga/src/server.ts
assertSingleExecutionValue
called by 222
packages/envelop/testing/src/index.ts
get
called by 199
packages/plugins/apq/src/index.ts
createSchema
called by 124
packages/graphql-yoga/src/schema.ts
set
called by 89
packages/plugins/apq/src/index.ts
useResponseCache
called by 76
packages/envelop/plugins/response-cache/src/plugin.ts
createSchema
called by 72
benchmark/envelop/app.js

Shape

Function 1,150
Method 180
Class 112
Interface 102
Enum 3

Languages

TypeScript100%

Modules by API surface

packages/plugins/apollo-usage-report/src/stats.ts65 symbols
packages/plugins/defer-stream/src/validations/overlapping-fields-can-be-merged.ts27 symbols
packages/envelop/plugins/response-cache/src/plugin.ts22 symbols
packages/plugins/apollo-inline-trace/src/index.ts20 symbols
packages/envelop/plugins/prometheus/test/prom.spec.ts19 symbols
packages/envelop/plugins/prometheus/src/utils.ts19 symbols
packages/plugins/apollo-usage-report/src/index.ts17 symbols
packages/nestjs/src/index.ts15 symbols
packages/envelop/plugins/statsd/src/index.ts15 symbols
packages/envelop/core/src/utils.ts15 symbols
examples/sofa/src/yoga.ts15 symbols
packages/graphql-yoga/src/server.ts14 symbols

Dependencies from manifests, versioned

@apollo/client4.0.9 · 1×
@apollo/datasource-rest6.4.1 · 1×
@apollo/gateway2.10.1 · 1×
@apollo/server5.5.0 · 1×
@apollo/server-gateway-interface2.0.0 · 1×
@apollo/subgraph2.9.3 · 1×
@apollo/usage-reporting-protobuf4.1.1 · 1×
@apollo/utils.keyvaluecache3.1.0 · 1×
@apollo/utils.usagereporting2.1.0 · 1×
@aws-cdk/assert2.68.0 · 1×
@aws-cdk/aws-apigateway1.204.0 · 1×
@aws-cdk/aws-lambda1.204.0 · 1×

For agents

$ claude mcp add graphql-yoga \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact