--- title: Welcome ---
GraphQL Ruby Logo

GraphQL Ruby

Install the Gem

{% highlight bash %} # Download the gem: gem install graphql # Setup with Rails: rails generate graphql:install {% endhighlight %}

Get going fast with the graphql gem, battle-tested and trusted by GitHub, Shopify, Chime, and Kickstarter.

Define Your Schema

Describe your application with the GraphQL schema to create a self-documenting, strongly-typed API.

{% highlight ruby %} # app/graphql/types/profile_type.rb class Types::ProfileType < Types::BaseObject field :id, ID, null: false field :name, String, null: false field :avatar, Types::PhotoType end {% endhighlight %}

Run Queries

{% highlight ruby %} # app/controllers/graphql_controller.rb result = MySchema.execute( params[:query], variables: params[:variables], context: { current_user: current_user }, ) render json: result {% endhighlight %}

Serve queries to build a great UI or webservice.

Add GraphQL to your Ruby app. Get Started!