Releasing Savvy Shuri: Dgraph v20.07

Update: On April 16th 2021, Slash GraphQL was officially renamed Dgraph Cloud. All other information below still applies.

We are happy to announce that Dgraph v20.07.0 (or more fondly called Savvy Shuri) has been released. Starting from this release, we have decided to name our major releases after characters and personalities that inspire and motivate us. The choice of using the fictional character Shuri is inspired by what she is famously known for: her genius, her tactical smartness, and her agility. And this is what we think Dgraph-Shuri also offers to the users.

This codename system allows us to reference our releases easily. This release will be referred to as “Shuri-Zero”. Any patch releases can be referred to as “Shuri-one”, “Shuri-two” and so on.

This post covers the major changes since v20.03, so you can get a quick overview of the new features, bug fixes, and other improvements all in one place.

More power to the GraphQL Database

Dgraph is the only native GraphQL database in the market. It gives you GraphQL at speed and scale, removing any additional layers and streaming the flow from client and backend to database.

Now, Dgraph gives you a complete GraphQL solution. In v20.07.0, we’ve added three major features: GraphQL subscriptions, built-in authorization, and custom logic.


GraphQL Subscriptions

Subscriptions are a GraphQL feature that allows a server to send data to its clients when a specific event happens. With GraphQL subscriptions, you can subscribe to the result of a query and be notified whenever the query produces different results. Dgraph records the GraphQL query and results in the server, and the subscription sends new data when the query result changes. There’s no extra backend required, just annotate the GraphQL types that allow subscriptions and clients can register.

Here is a step by step blog we created if you’re interested in learning more about how to use GraphQL subscriptions in Dgraph.

Built-in Authorization

Implementing authorization in your application is not an easy task. Dgraph now comes with built-in Authorization that lets you annotate your schema with rules that determine who can access or mutate what data. Your app is free to deal with authentication via a cloud service or bespoke solution. The connection between Dgraph and your authentication mechanism is a signed JWT - you provide the public key of the JWT signer and Dgraph uses that to verify the JWTs provided by the application.

A schema can then be annotated with the @auth directive to define authorization rules that enforce permissions from the JWT.

For more details take a look at our docs on authorization.

Custom Logic

With built-in custom logic, instead of executing your custom logic itself, Dgraph lets you integrate HTTP endpoints into your Dgraph app. That means GraphQL and REST endpoints can become either custom queries, mutations, or custom fields. This allows you to easily integrate existing GraphQL (or REST) services into your Dgraph GraphQL schema or to write your own business logic.

Enterprise features

In this release, we introduce two enterprise features. Both of these features are a result of listening to our users and prioritizing their requirements.

Vault Integration

Starting with release v20.07.0, we have introduced full integration with Vault. Vault is a purpose-built secure Key Management server. This feature set allows the encryption keys needed by Dgraph to be offloaded to Vault and allows secure approle based access to Dgraph. Vault has been integrated with Dgraph alpha, debug, bulk, live, restore, and online-restore tools/sub-commands.

Online restores

We have introduced online restores functionality that allows users to restore a backup to a live cluster. The old tool (still supported) requires you to copy the generated p directories to each alpha. This new way to restore a backup simply requires you to send a request through the admin endpoint and Dgraph will take care of the rest. This includes cleaning up the old data, writing the backup, moving groups around, etc.

Breaking Changes

This release also includes a breaking change in the format of facets which will help us scale the use of facets in Dgraph queries. For a complete list of breaking changes, take a look at the CHANGELOG.

Facets Format change

In v20.07.0, we have changed our facets format in JSON mutations/queries to be more user friendly. Now we will have the same facets format in JSON mutations and query results. This allows users to maintain a single struct/class for constructing mutations and parsing query results as opposed to two previously. The change also involves moving facets’ fields inside UID predicate fields in the JSON structure, for better readability.

Conclusion

This Dgraph release provides really powerful GraphQL features. With GraphQL subscriptions, built-in authorization, and custom logic, you get the easiest GraphQL application development experience with Dgraph. The best part? It’s all open source.

As always, we want to thank our lovely Dgraph community - the biggest reason that led us to this feature-packed release. Give it a try, and let us know your thoughts.

P.S. If you don’t want to bother with the headaches of deploying Dgraph GraphQL yourself, do check out Slash GraphQL. It is a fully managed GraphQL backend service, and you can start building your apps within minutes.