arctic-hen7 / diana
A Rust GraphQL system with full support for subscriptions and authentication that works out of the box.
Diana
Pragmatic GraphQL that just works.
Book • Crate Page • API Documentation • Contributing
Diana is a GraphQL system for Rust that's designed to work as simply as possible out of the box, without sacrificing configuration ability. Unlike other GraphQL systems, Diana fully supports serverless functions and automatically integrates them with a serverful subscriptions system as needed, and over an authenticated channel. GraphQL subscriptions are stateful, and so have to be run in a serverful way. Diana makes this process as simple as possible.
Diana's documentation can be found in the book.
Installation
Getting started with Diana is really easy! Just install it by adding this to your Cargo.toml
file:
diana = "0.2.9"
Due to the complexity of its components, Diana does have a lot of dependencies, so you may want to go and have a cup of tea while you wait for the installation…
A while ago, I was thinking about how to get serverless GraphQL working with subscriptions. Unfortunately, you can't easily, because subscriptions are state*ful*, and so they have to be run on a server*ful* system. But there's nothing to stop a serverful subscriptions system from being connected to a serverless queries/mutations system!
Diana is a GraphQL system for Rust that does just this. It's mostly a high-level wrapper around the excellent work of async_graphql, but it adds authentication and a bridge between serverful and serverless systems.
Right now, Diana supports integration with Actix Web and AWS Lambda (including derivatives like Netlify) out of the box, with support for more platforms coming soon! You can read Diana's documentation in the book.
Installation
You can easily install Diana by adding this to your Cargo.toml
under [dependencies]
:
diana = "0.2.3"
All Diana's integrations (currently diana-actix-web
and diana-aws-lambda
) are kept to the same version as the core library, so everything is always at the same version.
Usage
Diana is pretty easy to use, just define your configuration and set up the integration and you're good to go, with authentication built-in! There's more on how to do this in the docs here.
Closing Words
I've found Diana to be really useful so far for simplifying GraphQL in my own projects, so I hope it helps someone! Please open an issue on the repository if you find a bug or want to propose a new feature!
Top comments (0)