juniper Documentation

GraphQL server library for Rust

5,959 stars Rust Rust 1 file ยท ~4,213 tokens #cargo#graphql#rust#rust-library#web
RAW Doc

File: README.md

GraphQL server library for Rust





GraphQL is a data query language developed by Facebook intended to
serve mobile and web application frontends.

Juniper makes it possible to write GraphQL servers in Rust that are
type-safe and blazingly fast. We also try to make declaring and resolving
GraphQL schemas as convenient as Rust will allow.

Juniper does not include a web server - instead it provides building blocks to
make integration with existing servers straightforward. It optionally provides a
pre-built integration for the Actix, Hyper, Rocket, and Warp frameworks, including
embedded Graphiql and GraphQL Playground for easy debugging.

The book is also available for the master branch and older versions published after 0.11.1. See the book index.

Getting Started

The best place to get started is the Juniper Book, which contains
guides with plenty of examples, covering all features of Juniper. (very much WIP)

To get started quickly and get a feel for Juniper, check out the
Quickstart section.

For specific information about macros, types and the Juniper api, the
API Reference is the best place to look.

You can also check out the Star Wars schema to see a complex
example including polymorphism with traits and interfaces.
For an example of web framework integration,
see the actix, axum, hyper, rocket, and warp examples folders.

Features

Juniper supports the full GraphQL query language according to the
specification (October 2021), including interfaces, unions, schema
introspection, and validations. It can also output the schema in the GraphQL Schema Language.

As an exception to other GraphQL libraries for other languages, Juniper builds
non-null types by default. A field of type Vec<Episode> will be converted into
[Episode!]!. The corresponding Rust type for e.g. [Episode] would be
Option<Vec<Option<Episode>>>.

Juniper is agnostic to serialization format and network transport.

Juniper supports both asynchronous and synchronous execution using execute() and execute_sync() respectively. Asynchronous execution is runtime agnostic.

Juniper follows a code-first approach to defining GraphQL schemas. If you would like to use a schema-first approach instead, consider juniper-from-schema for generating code from a schema file.

Integrations

Data types

Juniper has automatic integration with some very common Rust crates to make
building schemas a breeze. The types from these crates will be usable in
your Schemas automatically.

Web Frameworks

Guides & Examples

API Stability

Juniper has not reached 1.0 yet, thus some API instability should be expected.


File: assets/logo/README.md

The rust-graphql logo is a derivative work based on

  • The GraphQL Logo licensed under the terms of the BSD license
  • The Rust Logo licensed under the terms of the CC-BY license

File: book/README.md

Juniper Book

Book containing the juniper user guide.

Contributing

Requirements

The Book is built with mdBook.

You may install it with:

bash
cargo install mdbook

Local test server

To launch a local test server that continually re-builds the Book and auto-reloads the page, run:

bash
mdbook serve

# or from project root dir:
make book.serve

Building

You may build the Book to rendered HTML with this command:

bash
mdbook build

# or from project root dir:
make book

The output will be in the _rendered/ directory.

Testing

To run the tests validating all code examples in the book, run (from project root dir):

bash
cargo build
mdbook test -L target/debug/deps

# or via shortcut:
make test.book

File: juniper/README.md

Juniper (GraphQL server library for Rust)




GraphQL is a data query language developed by Facebook and intended to serve mobile and web application frontends.

Juniper makes it possible to write GraphQL servers in Rust that are type-safe and blazingly fast. We also try to make declaring and resolving GraphQL schemas as convenient as Rust will allow.

Juniper doesn't include a web server - instead it provides building blocks to make integration with existing servers straightforward, including embedded GraphiQL and/or GraphQL Playground for easy debugging.

Getting Started

The best place to get started is Juniper Book, which contains guides with plenty of examples, covering all features of Juniper.

To get started quickly and get a feel for Juniper, check out the "Quickstart" section.

For specific information about macros, types and the Juniper API, the API docs is the best place to look.

Features

Juniper supports the full GraphQL query language according to October 2021 GraphQL specification, including interfaces, unions, schema introspection, and validations. It does not, however, support the schema language.

As an exception to other GraphQL libraries for other languages, Juniper builds non-null types by default. A field of type Vec<Episode> will be converted into [Episode!]!. The corresponding Rust type for e.g. [Episode] would be Option<Vec<Option<Episode>>>.

Integrations

Types

Juniper provides out-of-the-box integration for some very common Rust crates to make building schemas a breeze. The types from these crates will be usable in your schemas automatically after enabling the correspondent self-titled Cargo feature:

Web server frameworks

API stability

Juniper has not reached 1.0 yet, thus some API instability should be expected.

License

This project is licensed under BSD 2-Clause License.


File: juniper_actix/README.md

`juniper_actix` crate




actix-web web server integration for juniper (GraphQL implementation for Rust).

It's inspired and some parts are copied from juniper_warp crate.

Documentation

For documentation, including guides and examples, check out Juniper Book.

A basic usage example can also be found in the API docs.

Examples

Check examples/subscription.rs for example code of a working actix-web server with GraphQL handlers.

License

This project is licensed under BSD 2-Clause License.


File: juniper_axum/README.md

`juniper_axum` crate




axum web server integration for juniper (GraphQL implementation for Rust).

Documentation

For documentation, including guides and examples, check out Juniper Book.

A basic usage example can also be found in the API docs.

Examples

Check examples/simple.rs and examples/custom.rs for example code of a working axum server with GraphQL handlers.

License

This project is licensed under BSD 2-Clause License.


File: juniper_codegen/README.md

`juniper_codegen` crate




Code generation for juniper crate.

DO NOT use it directly, use juniper crate instead.

License

This project is licensed under BSD 2-Clause License.


File: juniper_hyper/README.md

`juniper_hyper` crate




hyper web server integration for juniper (GraphQL implementation for Rust).

Documentation

For documentation, including guides and examples, check out Juniper Book.

A basic usage example can also be found in the API docs.

Examples

Check examples/hyper_server.rs for example code of a working hyper server with GraphQL handlers.

License

This project is licensed under BSD 2-Clause License.


File: juniper_rocket/README.md

`juniper_rocket` crate




rocket web server integration for juniper (GraphQL implementation for Rust).

Documentation

For documentation, including guides and examples, check out Juniper Book.

A basic usage example can also be found in the API docs.

Examples

Check examples/simple.rs for example code of a working rocket server with GraphQL handlers.

License

This project is licensed under BSD 2-Clause License.