Directory Structure

A rusty-gql project has the following directory structure.

rusty-gql-project
 ┣ schema
 ┃ ┗ schema.graphql
 ┣ src
 ┃ ┣ graphql
 ┃ ┃ ┣ directive
 ┃ ┃ ┃ ┗ mod.rs
 ┃ ┃ ┣ input
 ┃ ┃ ┃ ┗ mod.rs
 ┃ ┃ ┣ mutation
 ┃ ┃ ┃ ┗ mod.rs
 ┃ ┃ ┣ query
 ┃ ┃ ┃ ┣ mod.rs
 ┃ ┃ ┣ resolver
 ┃ ┃ ┃ ┣ mod.rs
 ┃ ┃ ┣ scalar
 ┃ ┃ ┃ ┗ mod.rs
 ┃ ┃ ┗ mod.rs
 ┃ ┗ main.rs
 ┗ Cargo.toml

schema

GraphQL schema files are located under schema/**.

We can also place multiple GraphQL files.

For example, like this.

schema
 ┣ post
 ┃ ┗ post.graphql
 ┣ user
 ┃ ┗ user.graphql
 ┗ index.graphql

src/graphql/query

Query resolvers.

Query

src/graphql/mutation

Mutation resolvers.

Mutation

src/graphql/resolver

GraphQL Object, Enum, Union, Interface types.

src/graphql/input

GraphQL InputObject.

InputObject

src/graphql/scalar

Custom scalars.

Scalar

src/graphql/directive

Custom directives.

Directive