Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
R

rails-graphql

> 后端框架
Open source

A fresh, new GraphQL server designed for Rails applications, emphasizing a natural, Ruby-like DSL.

190 stars0 likes3 views
WebsiteGitHub

About

A fresh, new GraphQL server designed for Rails applications, emphasizing a natural, Ruby-like DSL.

Wiki | Bugs

Description

rails-graphql is a fresh new implementation of a GraphQL server, designed to be as close as possible to Rails architecture and interfaces, which implies that it has shortcuts, lots of syntax sugar, and direct connection with Rails features like ActiveRecord and ActionCable.

This gem has its own parser, written from scratch, using the C-API of Ruby, which empowers it with an outstanding performance. Plus, all the features provided were carefully developed so that everyone will feel comfortable and able to apply in all application sizes and patterns.

3 Simple Steps

Install

bash
# Add the gem to your Gemfile
$ bundle add rails-graphql
# Then run the Rails generator
$ rails g graphql:install

Define

ruby
# app/graphql/app_schema.rb
class GraphQL::AppSchema < GraphQL::Schema
  field(:welcome).resolve { 'Hello World!' }
end

Run

bash
$ curl -d '{"query":"{ welcome }"}' \
       -H "Content-Type: application/json" \
       -X POST http://localhost:3000/graphql
# {"data":{"welcome":"Hello World!"}}

Features

Link Description
GraphQL Parser Supporting the October 2021 spec
Schemas One or multiple under the same application or across multiple engines
Queries 3 different ways to defined your queries, besides sources
Mutations 3 different ways to defined your mutations, besides sources
Subscriptions 3 different ways to defined your subscriptions, besides sources
Directives 4 directives provided: @deprecated, @skip, @include, and @specifiedBy
Event-driven interface to facilitate new directives
Scalars All the spec scalars plus: any, bigint, binary, date, date_time, decimal, json, and time
Sources A bridge between classes and GraphQL types and fields
Fully implemented for ActiveRecord for PostgreSQL, MySQL, and SQLite databases
Generators Rails generators for you to get start quickly
Shortcuts Several shortcuts through ::GraphQL module to access classes within the gem
Type Map A centralized place where all the types are stored and can be resolved
Global ID All objects defined supports .to_global_id, or simply .to_gid
Subscriptions Provider Current supporting only ActionCable provider and Memory store
Introspection All necessary types for introspection with proper descriptions
Plain text display of the schemas
Testing Support to validate GraphQL documents and stub values before requests
Error Handling Full support to rescue_from within schemas
A gracefully backtrace display

How to contribute

To start, simply fork the project.

Run local tests using:

$ bundle install
$ bundle exec rake compile
$ bundle exec rake test

Finally, change the code and submit a pull request.

License

Copyright © 2020-2023 VirtualShield LLC. See The MIT License for further details.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rubyactiverecordgraphqlrailsruby

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category后端框架
PricingOpen source

> Related tools

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架