async-graphql
a high-performance graphql server library that's fully specification compliant
Book • 中文文档 • Docs • GitHub repository • Cargo package
This crate uses #![forbid(unsafe_code)]
to ensure everything is implemented in 100% safe Rust.
;
async
Features
- Fully supports async/await
- Type safety
- Rustfmt friendly (Procedural Macro)
- Custom scalars
- Minimal overhead
- Easy integration (poem, actix_web, tide, warp, rocket ...)
- Upload files (Multipart request)
- Subscriptions (WebSocket transport)
- Custom extensions
- Error extensions
- Limit query complexity/depth
- Batch queries
- Apollo Persisted Queries
- Apollo Tracing extension
- Apollo Federation(v2)
Note: Minimum supported Rust version: 1.59.0 or later
Examples
All examples are in the sub-repository, located in the examples directory.
git submodule update # update the examples repo
cd examples && cargo run --bin [name]
Integrations
Integrations are what glue async-graphql
with your web server, here are provided ones, or you can build your own!
- Poem async-graphql-poem
- Actix-web async-graphql-actix-web
- Warp async-graphql-warp
- Tide async-graphql-tide
- Rocket async-graphql-rocket
- Axum async-graphql-axum
Crate features
This crate offers the following features, all of which are not activated by default:
feature | enables |
---|---|
apollo_tracing |
Enable the Apollo tracing extension. |
apollo_persisted_queries |
Enable the Apollo persisted queries extension. |
log |
Enable the Logger extension. |
tracing |
Enable the Tracing extension. |
opentelemetry |
Enable the OpenTelemetry extension. |
unblock |
Support Asynchronous reader for Upload |
bson |
Integrate with the bson crate. |
chrono |
Integrate with the chrono crate. |
chrono-tz |
Integrate with the chrono-tz crate. |
url |
Integrate with the url crate. |
uuid |
Integrate with the uuid crate. |
uuid08 |
Integrate with the uuid 0.8 crate. |
string_number |
Enable the StringNumber. |
dataloader |
Support DataLoader. |
secrecy |
Integrate with the secrecy crate. |
decimal |
Integrate with the rust_decimal crate. |
bigdecimal |
Integrate with the bigdecimal crate. |
cbor |
Support for serde_cbor. |
smol_str |
Integrate with the smol_str crate. |
hashbrown |
Integrate with the hashbrown crate. |
time |
Integrate with the time crate. |
tokio-sync |
Integrate with the tokio::sync::RwLock and tokio::sync::Mutex . |
fast_chemail |
Integrate with the fast_chemail crate. |
Observability
One of the tools used to monitor your graphql server in production is Apollo Studio. Apollo Studio is a cloud platform that helps you build, monitor, validate, and secure your organization's data graph.
Add the extension crate async_graphql_apollo_studio_extension
to make this avaliable.
Who's using async-graphql
in production?
- Vector
- DiveDB
- Kairos Sports tech
- AxieInfinity
- Nando's
- Prima.it
- VoxJar
- Zenly
- Brevz
- thorndyke
- My Data My Consent
Community Showcase
- rust-actix-graphql-sqlx-postgresql Using GraphQL with Rust and Apollo Federation
- entity-rs A simplistic framework based on TAO, Facebook's distributed database for Social Graph.
- vimwiki-server Provides graphql server to inspect and manipulate vimwiki files.
- Diana Diana is a GraphQL system for Rust that's designed to work as simply as possible out of the box, without sacrificing configuration ability.
- cindythink
- sudograph
Blog Posts
- Async GraphQL with Rust
- GraphQL in Rust
- How to implement a Rust micro-service using Rocket, GraphQL, PostgreSQL
- Running GraphQL on Lambda with Rust
References
- GraphQL
- GraphQL Multipart Request
- GraphQL Cursor Connections Specification
- GraphQL over WebSocket Protocol
- Apollo Tracing
- Apollo Federation
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT) at your option.