Open sourcing the Grafbase Engine

Open Sourcing the Grafbase
Engine


At Grafbase, as with most modern tech companies, our code relies on open source and open standards. We have built our platform on Rust and WebAssembly, and we use countless libraries that authors and maintainers provide to the community over the years. We use open source and we believe in open source, and today we’re proud to open-source our Grafbase Engine.

The Grafbase Engine forms the core of the Grafbase platform. With this library, anyone will be able to deploy their own GraphQL backends to the edge, build out their own schemas in SDL and TypeScript, and expand out the engine to fit their needs and the needs of others in the community.

By making the Grafbase Engine open-source, we contribute back to the community and share our perspective on using GraphQL as the central API for all your data.

The GitHub repo for Grafbase Engine is available here.

Grafbase Engine allows you to connect all your data and APIs to a single GraphQL endpoint and deploy that backend to the edge in seconds.

We wrote the Grafbase Engine in Rust and compiled it to WebAssembly. This lets you run the engine in V8 isolates to achieve the extremely fast cold starts you desire from an edge endpoint. The Grafbase platform runs on Cloudflare Workers, but you can choose to deploy the engine however you want–on Cloudflare, on Deno, on a Lambda, or within a Docker container.

You can run it as WebAssembly or natively in Rust. The choice of infrastructure is yours with the OS version.

We built the Grafbase Engine on top of the excellent async-graphql library. We extended this library to build Grafbase with one fundamental purpose: enabling our users to define schemas in Schema Definition Language (SDL) and TypeScript. This speeds up development, reduces boilerplate code, and improves the developer experience.

You can use this functionality in the Grafbase Engine. You don’t have to define your schemas in the core Rust; instead you can use either SDL, or, even better, just define your schemas as Types in TypeScript. Under the hood, the engine generates the SDL for your GraphQL API.

This allows you to discover errors in your schema definitions at compile time or even immediately within your IDE, meaning you’ll always ship robust schema definitions.

Grafbase engine also supports running resolvers in JavaScript. This means you can extend your GraphQL API with resolvers written in JavaScript or TypeScript (and soon WebAssembly!)

We currently have three connectors available - GraphQL, OpenAPI, and MongoDB, and Postgres. But with every new use case, a new connector is needed. Snowflake, PlanetScale, Stripe, OpenAI – the community needs all these connectors, but we haven't built them yet. By opening up the code, users can build what they need without waiting for our team to catch up.

Opening the engine to the community also means users can extend the core functionality as they need beyond what is on our roadmap. As Grafbase Engine works in Wasm, developers can build in their preferred language, whether that is still Rust, or it’s Go or C/C++ or C# or a ton of other languages, compile to WebAssembly, and have the exact GraphQL backend they need.

To facilitate this type of experimentation and development, we are releasing the Grafbase Engine under the Mozilla Public License 2.0 (MPL). This license offers maximum flexibility in how people use the engine and how they can contribute.

You can check out the license here. The core idea behind MPL is its nature as a “file-level copyleft” license. If you modify a file covered by the MPL, you must release your modified file under the MPL. This approach ensures sharing any changes or improvements to that specific file with the community.

However, if you add or combine files with the MPL-covered ones, you don't need to release them under the MPL unless they contain code from the original MPL-covered files. This means you can have a project where some files are MPL-licensed, and others are under different licenses or even proprietary.

You can start by forking our engine from our repo. This will give you all the core functionality of Grafbase and the ability to use the engine on any deployment infrastructure that suits your needs. If you still want a hosted version that will get you a globally distributed GraphQL backend in seconds, with built-in authentication, edge caching, branching, and analytics, you can check out the Grafbase platform for easy deployment.

At Grafbase, we see GraphQL APIs as the ideal solution for deploying edge-native backends that scale. They offer speed, robustness, and a developer experience that your frontend devs will love. We've open-sourced the Grafbase Engine hoping that more teams can take advantage of this technology and build the APIs their teams need.

Get Started

Start building your federated graph now.