graphql-yoga
Fully-featured GraphQL Server with focus on easy setup, performance & great developer experience
You can try out the alpha
release today and give us feedback!.
We are working on documentation and examples for the alpha
release. You can check them out https://graphql-yoga.vercel.app
Installation
npm i graphql-yoga@alpha graphql
Basic Usage
We are actively working on API for the library. This is a very simple example of how to use it:
const { createServer } = require('graphql-yoga')
const { GraphQLSchema, GraphQLObjectType, GraphQLString } = require('graphql')
const schema = new GraphQLSchema({
query: new GraphQLObjectType({
name: 'Query',
fields: () => ({
ping: {
type: GraphQLString,
resolve: () => 'pong',
},
}),
}),
})
// Provide your schema
const server = createServer({
schema,
isDev: process.env.NODE_ENV !== 'production',
})
// Start the server and explore http://localhost:4000/graphql
server.start()
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...) and fits seamless in your GraphQL workflow.
- W3C Fetch API: the core package depends on W3C 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
- GraphQL spec-compliant
- HTTP based on
fastify
- TypeScript
- File upload
- Realtime capabilities
- Accepts both
application/json
andapplication/graphql
content-types - Supports ESM
- Runs everywhere: Can be deployed via
now
,up
, AWS Lambda, Heroku etc.
Contributing
If this is your first time contributing to this project, please do read our Contributor Workflow Guide before you get started off.
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 of Conduct as adopted from Contributor Covenant
License
MIT