async-graphql/README.md

124 lines
3.9 KiB
Markdown
Raw Normal View History

# A GraphQL server library implemented in Rust
2020-03-01 13:56:14 +00:00
<div align="center">
<!-- CI -->
2020-04-28 07:41:31 +00:00
<img src="https://github.com/async-graphql/async-graphql/workflows/CI/badge.svg" />
2020-04-05 08:22:13 +00:00
<!-- codecov -->
2020-06-02 01:31:13 +00:00
<img src="https://codecov.io/gh/async-graphql/async-graphql/branch/master/graph/badge.svg" />
2020-03-01 13:56:14 +00:00
<!-- Crates version -->
<a href="https://crates.io/crates/async-graphql">
<img src="https://img.shields.io/crates/v/async-graphql.svg?style=flat-square"
alt="Crates.io version" />
</a>
<!-- Downloads -->
<a href="https://crates.io/crates/async-graphql">
<img src="https://img.shields.io/crates/d/async-graphql.svg?style=flat-square"
alt="Download" />
</a>
<!-- docs.rs docs -->
<a href="https://docs.rs/async-graphql">
<img src="https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square"
alt="docs.rs docs" />
</a>
<a href="https://github.com/rust-secure-code/safety-dance/">
<img src="https://img.shields.io/badge/unsafe-forbidden-success.svg?style=flat-square"
alt="Unsafe Rust forbidden" />
</a>
2020-03-01 13:56:14 +00:00
</div>
2020-05-03 13:46:38 +00:00
`Async-graphql` is a high-performance server-side library that supports all GraphQL specifications.
2020-03-12 09:21:49 +00:00
2020-05-03 13:46:38 +00:00
* [Feature Comparison](feature-comparison.md)
2020-05-10 01:41:13 +00:00
* [Book](https://async-graphql.github.io/async-graphql/en/index.html)
* [中文文档](https://async-graphql.github.io/async-graphql/zh-CN/index.html)
2020-03-21 07:11:46 +00:00
* [Docs](https://docs.rs/async-graphql)
2020-04-28 07:41:31 +00:00
* [GitHub repository](https://github.com/async-graphql/async-graphql)
2020-03-01 13:56:14 +00:00
* [Cargo package](https://crates.io/crates/async-graphql)
2020-09-06 10:29:46 +00:00
* Minimum supported Rust version: 1.46 or later
2020-03-01 13:56:14 +00:00
## Safety
2020-06-03 11:33:32 +00:00
This crate uses `#![forbid(unsafe_code)]` to ensure everything is implemented in 100% Safe Rust.
2020-06-02 23:46:34 +00:00
## Features
2020-07-07 09:03:01 +00:00
* Fully supports async/await
2020-06-02 23:46:34 +00:00
* Type safety
* Rustfmt friendly (Procedural Macro)
2020-07-07 09:03:01 +00:00
* Custom scalars
2020-06-02 23:46:34 +00:00
* Minimal overhead
2020-09-14 06:13:43 +00:00
* Easy integration (actix_web, tide, warp, rocket ...)
2020-06-02 23:46:34 +00:00
* Upload files (Multipart request)
2020-07-07 09:03:01 +00:00
* Subscriptions (WebSocket transport)
* Custom extensions
2020-06-02 23:46:34 +00:00
* Apollo Tracing extension
* Limit query complexity/depth
* Error Extensions
* Apollo Federation
2020-09-17 08:39:55 +00:00
* Batch Queries
2020-09-30 03:44:18 +00:00
* Apollo Persisted Queries
2020-09-26 03:25:21 +00:00
2020-04-14 01:53:17 +00:00
## Examples
2020-03-09 12:44:31 +00:00
2020-10-16 01:21:16 +00:00
All examples are in the [sub-repository](https://github.com/async-graphql/examples), located in the examples directory.
**Run an example:**
```shell
git submodule update # update the examples repo
cd examples && cargo run --bin [name]
```
2020-03-09 12:44:31 +00:00
2020-04-02 07:51:04 +00:00
## Benchmark
2020-06-01 16:05:37 +00:00
Ensure that there is no CPU-heavy process in background!
2020-04-02 07:51:04 +00:00
```shell script
2020-06-01 16:05:37 +00:00
cd benchmark
2020-06-02 14:51:32 +00:00
#measure all with system malloc
2020-06-01 16:05:37 +00:00
cargo bench
2020-06-02 14:51:32 +00:00
#measure only chat run
cargo bench -- "chat run"
#measure all with jemalloc
cargo bench --features jemalloc
#measure only simple run with jemalloc
2020-06-02 14:51:32 +00:00
cargo bench --features jemalloc -- "simple run"
2020-04-02 07:51:04 +00:00
```
2020-06-01 16:05:37 +00:00
Now HTML report is available at `benchmark/target/criterion/report`
2020-06-02 12:57:07 +00:00
Read more here: https://bheisler.github.io/criterion.rs/book/criterion_rs.html
2020-03-18 00:44:41 +00:00
## Integrations
* Actix-web [async-graphql-actix-web](https://crates.io/crates/async-graphql-actix-web)
2020-04-14 03:44:08 +00:00
* Warp [async-graphql-warp](https://crates.io/crates/async-graphql-warp)
2020-04-26 15:10:16 +00:00
* Tide [async-graphql-tide](https://crates.io/crates/async-graphql-tide)
* Rocket [async-graphql-rocket](https://github.com/async-graphql/async-graphql/tree/master/integrations/rocket)
2020-03-18 00:44:41 +00:00
2020-03-03 03:48:00 +00:00
## 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.
2020-03-01 14:13:37 +00:00
2020-03-01 13:56:14 +00:00
## References
* [GraphQL](https://graphql.org)
2020-03-19 09:20:12 +00:00
* [GraphQL Multipart Request](https://github.com/jaydenseric/graphql-multipart-request-spec)
* [GraphQL Cursor Connections Specification](https://facebook.github.io/relay/graphql/connections.htm)
* [GraphQL over WebSocket Protocol](https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md)
2020-03-26 03:34:28 +00:00
* [Apollo Tracing](https://github.com/apollographql/apollo-tracing)
2020-04-10 02:28:27 +00:00
* [Apollo Federation](https://www.apollographql.com/docs/apollo-server/federation/introduction)
2020-03-22 08:45:59 +00:00
## Contribute
2020-05-25 21:37:46 +00:00
Welcome to contribute !