Announcing Open Source Hasura GraphQL Engine v3
Ever since the Hasura DDN announcement at HasuraCon 2023 earlier this year and the subsequent public alpha release recently, the team has been working with a shared commitment to push the boundaries of the best way to build an API. We are super excited to open source Hasura v3 GraphQL Engine – an action foundational to that goal.
At the center of this announcement lies the new architecture of the core graphql-engine written in Rust, moving away from Haskell. This strategic move isn't just about adopting a new language. It's about embracing performance, scalability, and reliability in a way that redefines what's achievable by building the best cloud-native APIs, while also leveraging the broader Rust community and ecosystem.
> Here’s a recent Reddit thread on how and why we moved away from Haskell to Rust.
What to expect in Hasura v3
- Data connectors: The v3-engine can be used with any connector that adheres to the NDC specification to get a GraphQL API. We currently have NDC agents available for PostgreSQL, ClickHouse, and Deno (TypeScript). Learn more about Hasura connectors here.
- Metadata Modeling Objects: Use these metadata objects to map the underlying data sources using NDC agents and create a supergraph:
- Models: Collections of data objects that can be queried. These serve as the interface for querying your data. A model may be backed by a database table, an ad-hoc SQL query, a pre-materialized view, or a custom API server.
- Commands: Opaque functions or procedures that can be used to query or mutate data. You can use them to validate, process, enrich some data, or call another API.
- Permissions: Access control rules on your types / models / commands. There are two types of permissions available – model permissions and type permissions.
- Relationships: Creating edges in your graph from a data type to a model or a command. A relationship allows you to query nested or linked information and it can span across multiple data sources such as from PostgreSQL to ClickHouse.
- Global ID: A unique identifier for an object across the entire application, not just within a specific table or type. The Global ID generated by Hasura DDN follows the Relay Global ID spec and can be used to fetch any object directly.
- Business logic: Now write your business logic in TypeScript and use Hasura to front them as queries and mutations using the TypeScript Deno connector.
- Mutations: Leverage the flexibility of mutating data in the following ways:
- Using the TypeScript Deno connector which exposes TypeScript functions as Hasura commands, which can be made available over the GraphQL API as a mutation. You can write to a database or an API and incorporate any business logic in the Typescript function while mutating.
- Using native query functionality for PostgreSQL and including a RETURNING clause in the SQL, listing the returned columns.
- Point-to-point (simple) database inserts, updates, and deletes via the respective data connectors are coming soon.
Check out the full changelog here.
What else is open source?
Hasura DDN is the fastest way to create graphs for all your data and compose them into a supergraph. This involves multiple components in the architecture:
- graphql-engine (v3): The core engine that powers the Hasura DDN and supergraph.
- ndc-spec: The data connector spec that contains the specification for Hasura's Native Data Connectors (NDC)
- ndc-hub: A registry of community-contributed open source connectors that are built to work with the ndc-spec.
We have open sourced the data connectors for PostgreSQL, ClickHouse, Turso, DuckDB, and Qdrant to begin with, and all data connectors that we build at Hasura going forward will be open source. Some of the upcoming data connectors include MongoDB, DynamoDB, MySQL, Oracle, etc., and everything will work with the NDC specification.
What does this mean for you?
The core of Hasura has always been open source. So what’s new?
There is more flexibility than ever in writing your own data connector from scratch, forking an existing data connector, and customizing it to your specific application needs.
With Hasura v2, the query generation for PostgreSQL (and SQL Server and BigQuery) was tied to the core graphql-engine, Haskell. We then introduced data connectors in v2, which allowed the query generation for more databases to be outside the engine.
With v3 graphql-engine, ndc-spec, and ndc-hub, all data connectors are open source and you now have full flexibility to write, contribute, and fork any data connector to your application-specific needs.
Alpha Phase
This release marks the initial phase of our alpha rollout. Please note that Hasura v3 is still in its early stages and has limited functionality. We encourage feedback, bug reports, and contributions from the community to help us shape the future of this project.
Contribute to graphql-engine v3
As you might have noticed, Hasura v3 graphql-engine is written in Rust. If you are looking to contribute Rust code, feel free to check out our contributing guide, pick up any open issue, and get started.
Writing and contributing to a data connector
All of our data connectors are based on the OSS NDC Spec, which is designed to be as general as possible, supporting many different types of data sources while still being targeted enough to provide useful features with high-performance guarantees.
We have SDKs in Rust and TypeScript for you to get started with building a connector or contributing to one of the existing connectors.
Get started with Hasura DDN
You can quickly get started with Hasura for free.
We have an FAQ to answer all your questions.
Join Hasura Discord
You can ask questions about v3 on our ddn-alpha Discord channel, where we will also be posting regular product updates.
Please share your feedback, call out any bugs or glitches in the developer experience, and get involved with the Hasura community on Discord.
Your participation and feedback are invaluable as we work towards more updates and exciting features in the upcoming releases! 🚀