- Notifications
You must be signed in to change notification settings - Fork430
GraphQL server library for Rust
License
graphql-rust/juniper
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
GraphQL server library for Rust
GraphQL is a data query language developed by Facebook intended toserve mobile and web application frontends.
Juniper makes it possible to write GraphQL servers in Rust that aretype-safe and blazingly fast. We also try to make declaring and resolvingGraphQL schemas as convenient as Rust will allow.
Juniper does not include a web server - instead it provides building blocks tomake integration with existing servers straightforward. It optionally provides apre-built integration for theActix,Hyper,Rocket, andWarp frameworks, includingembeddedGraphiql andGraphQL Playground for easy debugging.
- Cargo crate
- API Reference
- Book: Guides and Examples (current |master)
The book is also available for the master branch and older versions published after 0.11.1. See thebook index.
The best place to get started is theJuniper Book, which containsguides with plenty of examples, covering all features of Juniper. (very much WIP)
To get started quickly and get a feel for Juniper, check out theQuickstart section.
For specific information about macros, types and the Juniper api, theAPI Reference is the best place to look.
You can also check out theStar Wars schema to see a complexexample including polymorphism with traits and interfaces.For an example of web framework integration,see theactix,axum,hyper,rocket, andwarp examples folders.
Juniper supports the full GraphQL query language according to thespecification (October 2021), including interfaces, unions, schemaintrospection, and validations. It can also output the schema in theGraphQL Schema Language.
As an exception to other GraphQL libraries for other languages, Juniper buildsnon-null types by default. A field of typeVec<Episode>
will be converted into[Episode!]!
. The corresponding Rust type for e.g.[Episode]
would beOption<Vec<Option<Episode>>>
.
Juniper is agnostic to serialization format and network transport.
Juniper supports both asynchronous and synchronous execution usingexecute()
andexecute_sync()
respectively. Asynchronous execution is runtime agnostic.
Juniper follows acode-first approach to defining GraphQL schemas. If you would like to use aschema-first approach instead, considerjuniper-from-schema for generating code from a schema file.
Juniper has automatic integration with some very common Rust crates to makebuilding schemas a breeze. The types from these crates will be usable inyour Schemas automatically.
Juniper has not reached 1.0 yet, thus some API instability should be expected.
About
GraphQL server library for Rust