Batteries Included Reimagined - The Revival of GraphQL Yoga

Rate this content
Bookmark

The Guild has recently released Envelop - a new, modern GraphQL Server Framework and plugin system. In this talk I’ll share a brief overview of Envelop and why you should probably upgrade your existing GraphQL server to it.

This talk has been presented at GraphQL Galaxy 2021, check out the latest edition of this Tech Conference.

FAQ

Envelope is a powerful GraphQL plugin system designed for use on servers. It allows for extensive customization and optimization of GraphQL server operations through a system of before and after hooks into the GraphQL execution lifecycle, making it easier and more efficient to build scalable and maintainable GraphQL APIs.

GraphQL Yoga is a widely recognized GraphQL framework that was originally developed by Prisma. It has been reimagined and revived by the Guild as a more opinionated, batteries-included framework built around the Envelope plugin system. The new version aims to simplify the process of starting a GraphQL server while still offering high performance and flexibility through its use of plugins.

The Guild is a major open-source group that contributes to the GraphQL ecosystem by developing a variety of libraries and tools. Each library is developed independently but fits into a broader vision of providing a cohesive platform for GraphQL development, from data source integration to front-end management without vendor lock-in.

The Guild has developed several key libraries including GraphQL Code Generator, GraphQL Tools, Sceva Stitching, and GraphQL Inspector. These tools serve various purposes such as generating GraphQL APIs from different sources, preventing breaking changes, and managing distributed GraphQL architecture across enterprise teams.

Envelope enhances GraphQL servers by introducing a plugin-based architecture that allows for fine-grained control over the GraphQL execution process. Developers can use plugins to cache parser and validation steps, use GraphQL JIT for improved query execution, and customize the server behavior to better fit their specific needs.

GraphQL Yoga 2.0 offers an easy-to-use, highly performant server setup with out-of-the-box support for modern GraphQL features like subscriptions, defer, and stream. It combines the simplicity of its predecessor with the powerful plugin system of Envelope, making it suitable for both new projects and existing large-scale applications.

The Guild's philosophy emphasizes creating tools based on necessity and community needs rather than arbitrary development. This approach ensures that their tools are practical, maintained, and capable of addressing specific problems faced by developers in the GraphQL community.

Yes, Envelope is designed to be interoperable with other GraphQL server frameworks such as Apollo Server. It can enhance existing frameworks by adding powerful plugin capabilities and can even replace components like the Apollo Gateway in federated setups to provide additional flexibility and features.

Uri Goldshtein
Uri Goldshtein
33 min
09 Dec, 2021

Comments

Sign in or register to post your comment.

Video Summary and Transcription

Envelope is a powerful GraphQL plugin system that simplifies server development and allows for powerful plugin integration. It provides conformity for large corporations with multiple GraphQL servers and can be used with various frameworks. Envelope acts as the Babel of GraphQL, allowing the use of non-spec features. The Guild offers GraphQL Hive, a service similar to Apollo Studio, and encourages collaboration with other frameworks and languages.

1. Introduction to Envelope and the Guild

Short description:

Hi, everyone. My name is Uli, and I'm really excited to give the first keynote talk at GraphQL Galaxy. Today, I'm going to talk about Envelope, our new GraphQL plugin system that you should use on your servers today. The Guild is the largest open source group in the GraphQL ecosystem. We develop many libraries, they all fit into one big vision.

Hi, everyone. My name is Uli, and I'm really excited to give the first keynote talk at GraphQL Galaxy. Today, I'm going to talk about Envelope, our new GraphQL plugin system that you should use on your servers today. But there's also, for this talk, I have a surprise secondary title talk. Batteries Included Reimagined, the Revival of GraphQL Yoga. Those of you who know the Guild and know GraphQL Yoga should get excited by now. I'm going to talk a bit about that later. Stay tuned.

The Guild is the largest open source group in the GraphQL ecosystem. We develop many libraries, they all fit into one big vision. But the idea is that each library is individual. Some examples are GraphQL Code Generator, GraphQL Tools, and Sceva Stitching, GraphQL to basically take any source like OpenAPI, Swagger, gRPC, SQL, and generate GraphQL APIs out of them. GraphQL Inspector for preventing breaking changes, GraphQL Modules for distributing the work between many different teams in the enterprise, and many, many others. And the philosophy of the Guild is that each of these tools should and is developed completely independently. You don't need to use the other tools in order to use any of the tools here. They are fitting into one big platform, from the database and the data sources all the way to the front-end. But you're not vendor-locked. You could gradually introduce these tools when you actually see fit and you see the need. Also, part of our philosophy is not to develop tools that we just want to develop, but only tools that we see a necessity and a need. We rather rely on other open source tools and also contribute to them. But every time we see that the library is not maintained or is not able to accept things that we need from it, only then we basically create a new library. Or what we do many times is we take unmaintained libraries and revive them.

So at the beginning of this year, we saw a lot of need around the GraphQL server ecosystem. And we tried to figure out what do we need and how can we improve it. We tried to contribute it and have talks with existing frameworks in the community. And we ended up creating our own solution. So today I want to talk with you about Envelope. You should also check out the website and look at it there. But I want today to start actually for what was our mindset when we started actually creating Envelope. So the first thing we started asking ourselves, we looked at the existing ecosystem, we asked what do we actually need from a GraphQL server? I mean, this is like a slide that I use in many, many of my talks.

2. GraphQL JS and the GraphQL Server

Short description:

GraphQL JS is the core of the system, providing functions like validate, parse, execute, and subscribe. However, a GraphQL server needs additional features such as schema creation, communication layer integration, and operational aspects like caching, tracing, logging, security, and error handling. The current server ecosystem has issues with opinionated and poorly maintained frameworks, which can limit flexibility and updates.

Basically, you see here a client queries a GraphQL server, the GraphQL server then sends calls to all kinds of sources and all kinds of places and the server will send me back one result, orchestrate all the calls and will send it back one result as I expect. And this is something we all know. What is the mechanism here and what do we need from it?

So the core of it is GraphQL JS itself, the reference implementation and the reference implementation. Actually, if we look at the code inside, basically expose a couple of functions for us. Validate, parse, execute, and subscribe. Validate is around validating the schema and the query to make sure that it's actually a valid schema and query. Parse is parsing the query as AST and understand and make it into a document that we can execute. And then the execute function itself which I give a lot of talks around how it looks inside. This is like a pseudocode slide about what's actually happening inside the execute function, meaning the execute function will get the executable schema and the query, and then do all the orchestration and automation work to get the right result in the shape that we want, orchestrating everything that's happening with the network calls or the resolvers. So that's basically the execute function and GraphQL JS. Those are the things that GraphQL JS gives us. But then there's the server. What are the extra things that GraphQL JS doesn't give us that we need from a GraphQL server?

So one thing is the schema creation itself. GraphQL JS has its own way of creating the schema, but the community actually diverges and created many different solutions to create a schema, like SDL-first, a code first with tools like Nexus or GraphQL, which is very exciting and worth checking out, and many others. So you want to create your own schema in many different ways. The other thing that we need to connect GraphQL JS to is actually the communication layer. We need to connect it to an HTTP server, maybe work across WebSockets, and maybe we want to deploy it in a serverless environment and we need all kinds of constraints and things there. And we want our GraphQL server to take care of that for us. And there's many, many different things around operating this GraphQL server, caching and performance, tracing, logging, security and auth, and good error handling. And of course, we want the GraphQL server to have a thriving ecosystem. We want like people to be able to create many different solutions across the GraphQL service so we could use it in any of our use cases and not rely on one single use case that that's the only thing that we need for our server. So once we figured that out, we looked at the actual landscape and this is like a very opinionated slide. You can argue with us, I would love to. But we think that the current server ecosystem has some issues. First of all, the current most populous frameworks out there are very opinionated and sometimes not well maintained. And I think the combination of these two is very problematic. So first of all, being very opinionated means you're fitting into certain types of use cases, usually simple use cases, and because you want to get a lot of community and stuff like that. But then if you combine that with a poorly maintained or library, then it means that now your users can't actually change things and can't get things up to date. So together, this is a very problematic situation. And this is something we faced a lot when we worked with our clients.

QnA

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Simplifying Server Components
React Advanced Conference 2023React Advanced Conference 2023
27 min
Simplifying Server Components
Top Content
Watch video: Simplifying Server Components
React server components simplify server-side rendering and provide a mental model of components as pure functions. Using React as a library for server components allows for building a basic RSC server and connecting it to an SSR server. RSC responses are serialized virtual DOM that offload code from the client and handle interactivity. The client manifest maps serialized placeholders to real components on the client, enabling dynamic rendering. Server components combine the best of classic web development and progressive enhancement, offering the advantage of moving logic from the client to the server.
Exploring React Server Component Fundamentals
React Day Berlin 2023React Day Berlin 2023
21 min
Exploring React Server Component Fundamentals
Top Content
Watch video: Exploring React Server Component Fundamentals
This Talk introduces React Server Components (RSC) and explores their serialization process. It compares RSC to traditional server-side rendering (SSR) and explains how RSC handles promises and integrates client components. The Talk also discusses the RSC manifest and deserialization process. The speaker then introduces the Waku framework, which supports bundling, server, routing, and SSR. The future plans for Waku include integration with client state management libraries.
From GraphQL Zero to GraphQL Hero with RedwoodJS
GraphQL Galaxy 2021GraphQL Galaxy 2021
32 min
From GraphQL Zero to GraphQL Hero with RedwoodJS
Top Content
Tom Pressenwurter introduces Redwood.js, a full stack app framework for building GraphQL APIs easily and maintainably. He demonstrates a Redwood.js application with a React-based front end and a Node.js API. Redwood.js offers a simplified folder structure and schema for organizing the application. It provides easy data manipulation and CRUD operations through GraphQL functions. Redwood.js allows for easy implementation of new queries and directives, including authentication and limiting access to data. It is a stable and production-ready framework that integrates well with other front-end technologies.
Local State and Server Cache: Finding a Balance
Vue.js London Live 2021Vue.js London Live 2021
24 min
Local State and Server Cache: Finding a Balance
Top Content
This Talk discusses handling local state in software development, particularly when dealing with asynchronous behavior and API requests. It explores the challenges of managing global state and the need for actions when handling server data. The Talk also highlights the issue of fetching data not in Vuex and the challenges of keeping data up-to-date in Vuex. It mentions alternative tools like Apollo Client and React Query for handling local state. The Talk concludes with a discussion on GitLab going public and the celebration that followed.
And Now You Understand React Server Components
React Summit 2024React Summit 2024
27 min
And Now You Understand React Server Components
Top Content
In this Talk, Kent C. Dodds introduces React Server Components (RSCs) and demonstrates how to build them from scratch. He explains the process of integrating RSCs with the UI, switching to RSC and streaming for improved performance, and the benefits of using RSCs with async components. Dodds also discusses enhancements with streaming and server context, client support and loaders, server component rendering and module resolution, handling UI updates and rendering, handling back buttons and caching, and concludes with further resources for diving deeper into the topic.
A Practical Guide for Migrating to Server Components
React Advanced Conference 2023React Advanced Conference 2023
28 min
A Practical Guide for Migrating to Server Components
Top Content
Watch video: A Practical Guide for Migrating to Server Components
React query version five is live and we'll be discussing the migration process to server components using Next.js and React Query. The process involves planning, preparing, and setting up server components, migrating pages, adding layouts, and moving components to the server. We'll also explore the benefits of server components such as reducing JavaScript shipping, enabling powerful caching, and leveraging the features of the app router. Additionally, we'll cover topics like handling authentication, rendering in server components, and the impact on server load and costs.

Workshops on related topic

Build with SvelteKit and GraphQL
GraphQL Galaxy 2021GraphQL Galaxy 2021
140 min
Build with SvelteKit and GraphQL
Top Content
Featured WorkshopFree
Scott Spence
Scott Spence
Have you ever thought about building something that doesn't require a lot of boilerplate with a tiny bundle size? In this workshop, Scott Spence will go from hello world to covering routing and using endpoints in SvelteKit. You'll set up a backend GraphQL API then use GraphQL queries with SvelteKit to display the GraphQL API data. You'll build a fast secure project that uses SvelteKit's features, then deploy it as a fully static site. This course is for the Svelte curious who haven't had extensive experience with SvelteKit and want a deeper understanding of how to use it in practical applications.

Table of contents:
- Kick-off and Svelte introduction
- Initialise frontend project
- Tour of the SvelteKit skeleton project
- Configure backend project
- Query Data with GraphQL
- Fetching data to the frontend with GraphQL
- Styling
- Svelte directives
- Routing in SvelteKit
- Endpoints in SvelteKit
- Deploying to Netlify
- Navigation
- Mutations in GraphCMS
- Sending GraphQL Mutations via SvelteKit
- Q&A
Build Modern Applications Using GraphQL and Javascript
Node Congress 2024Node Congress 2024
152 min
Build Modern Applications Using GraphQL and Javascript
Featured Workshop
Emanuel Scirlet
Miguel Henriques
2 authors
Come and learn how you can supercharge your modern and secure applications using GraphQL and Javascript. In this workshop we will build a GraphQL API and we will demonstrate the benefits of the query language for APIs and what use cases that are fit for it. Basic Javascript knowledge required.
End-To-End Type Safety with React, GraphQL & Prisma
React Advanced Conference 2022React Advanced Conference 2022
95 min
End-To-End Type Safety with React, GraphQL & Prisma
Featured WorkshopFree
Sabin Adams
Sabin Adams
In this workshop, you will get a first-hand look at what end-to-end type safety is and why it is important. To accomplish this, you’ll be building a GraphQL API using modern, relevant tools which will be consumed by a React client.
Prerequisites: - Node.js installed on your machine (12.2.X / 14.X)- It is recommended (but not required) to use VS Code for the practical tasks- An IDE installed (VSCode recommended)- (Good to have)*A basic understanding of Node.js, React, and TypeScript
GraphQL for React Developers
GraphQL Galaxy 2022GraphQL Galaxy 2022
112 min
GraphQL for React Developers
Featured Workshop
Roy Derks
Roy Derks
There are many advantages to using GraphQL as a datasource for frontend development, compared to REST APIs. We developers in example need to write a lot of imperative code to retrieve data to display in our applications and handle state. With GraphQL you cannot only decrease the amount of code needed around data fetching and state-management you'll also get increased flexibility, better performance and most of all an improved developer experience. In this workshop you'll learn how GraphQL can improve your work as a frontend developer and how to handle GraphQL in your frontend React application.
Build a Headless WordPress App with Next.js and WPGraphQL
React Summit 2022React Summit 2022
173 min
Build a Headless WordPress App with Next.js and WPGraphQL
Top Content
WorkshopFree
Kellen Mace
Kellen Mace
In this workshop, you’ll learn how to build a Next.js app that uses Apollo Client to fetch data from a headless WordPress backend and use it to render the pages of your app. You’ll learn when you should consider a headless WordPress architecture, how to turn a WordPress backend into a GraphQL server, how to compose queries using the GraphiQL IDE, how to colocate GraphQL fragments with your components, and more.
Next.js 13: Data Fetching Strategies
React Day Berlin 2022React Day Berlin 2022
53 min
Next.js 13: Data Fetching Strategies
Top Content
WorkshopFree
Alice De Mauro
Alice De Mauro
- Introduction- Prerequisites for the workshop- Fetching strategies: fundamentals- Fetching strategies – hands-on: fetch API, cache (static VS dynamic), revalidate, suspense (parallel data fetching)- Test your build and serve it on Vercel- Future: Server components VS Client components- Workshop easter egg (unrelated to the topic, calling out accessibility)- Wrapping up