百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

rails-graphql

> 后端框架
开源

一个全新的 GraphQL 服务器,专为 Rails 应用程序设计,强调自然、类似 Ruby 的 DSL。

190 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

一个全新的 GraphQL 服务器,专为 Rails 应用程序设计,强调自然、类似 Ruby 的 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 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rubyactiverecordgraphqlrailsruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类后端框架
定价开源

> 相关工具

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