Async Graphql

A GraphQL server library implemented in Rust
Alternatives To Async Graphql
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Parse Server20,2701,1408918 hours ago220September 20, 2022402apache-2.0JavaScript
Parse Server for Node.js / Express
Apollo Server13,3665,3261,15315 hours ago305August 26, 202242mitTypeScript
🌍  Spec-compliant and production ready JavaScript GraphQL server that lets you develop in a schema-first way. Built for Express, Connect, Hapi, Koa, and more.
Graphql Shield3,448
a month ago89mitTypeScript
🛡 A GraphQL tool to ease the creation of permission layer.
Vulcain3,35823 months ago15October 14, 202122agpl-3.0Go
Fast and idiomatic client-driven REST APIs.
Strawberry3,244
20 hours ago383mitPython
A GraphQL library for Python that leverages type annotations 🍓
Meatier3,115
5 years ago36JavaScript
:hamburger: like meteor, but meatier :hamburger:
Async Graphql2,864522 days ago386September 26, 2022107apache-2.0Rust
A GraphQL server library implemented in Rust
Ariadne2,026102920 hours ago34April 22, 202255bsd-3-clausePython
Python library for implementing GraphQL servers using schema-first approach.
Graphpack1,9921212 years ago14February 26, 201934mitJavaScript
☄️ A minimalistic zero-config GraphQL server.
Json Graphql Server1,849405a month ago21August 24, 20229mitJavaScript
Get a full fake GraphQL API with zero coding in less than 30 seconds.
Alternatives To Async Graphql
Select To Compare


Alternative Project Comparisons
Readme

async-graphql

a high-performance graphql server library that's fully specification compliant

Book中文文档DocsGitHub repositoryCargo package


ci status code coverage Unsafe Rust forbidden Crates.io version docs.rs docs downloads PRs Welcome

This crate uses #![forbid(unsafe_code)] to ensure everything is implemented in 100% safe Rust.

Static schema

use std::error::Error;

use async_graphql::*;
use async_graphql_poem::*;
use poem::{*, listener::TcpListener};

struct Query;

#[Object]
impl Query {
  async fn howdy(&self) -> &'static str {
    "partner"
  }
}

async fn main() -> Result<(), Box<dyn Error>> {
  // create the schema
  let schema = Schema::build(Query, EmptyMutation, EmptySubscription).finish();

  // start the http server
  let app = Route::new().at("/", get(graphiql).post(GraphQL::new(schema)));
  println!("GraphiQL: http://localhost:8000");
  Server::new(TcpListener::bind("0.0.0.0:8000")).run(app).await?;
  Ok(())
}

Dynamic schema

use std::error::Error;

use async_graphql::dynamic::*;
use async_graphql_poem::*;
use poem::{*, listener::TcpListener};

let query = Object::new("Query")
  .field(Field::new("howdy", TypeRef::named_nn(TypeRef::STRING), |_| FieldFuture::new(async { "partner" })));

async fn main() -> Result<(), Box<dyn Error>> {
  // create the schema
  let schema = Schema::build(query, None, None)
    .register(query)
    .finish()?;

  // start the http server
  let app = Route::new().at("/", get(graphiql).post(GraphQL::new(schema)));
  println!("GraphiQL: http://localhost:8000");
  Server::new(TcpListener::bind("0.0.0.0:8000")).run(app).await?;
  Ok(())
}

Features

  • Static and dynamic schemas are fully supported
  • Fully supports async/await
  • Type safety
  • Rustfmt friendly (Procedural Macro)
  • Custom scalars
  • Minimal overhead
  • Easy integration (poem, axum, 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.65.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!

Crate features

This crate offers the following features. Most are not activated by default, except the integrations of GraphiQL (graphiql) and GraphQL Playground (playground):

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.
tempfile Save the uploaded content in the temporary file.
dynamic-schema Support dynamic schema
graphiql Enables the GraphiQL IDE integration
playground Enables the GraphQL playground IDE integration

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?

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

References

License

Licensed under either of

Popular Server Projects
Popular Graphql Projects
Popular Networking Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Rust
Server
Graphql
Apollo
Federation
Multipart