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

rails-devise-graphql

> 后端框架
开源

一个 Rails 6 套件,用于创建您的下一个 SaaS 产品。预装了 graphQL、devise、JWT、CanCanCan、RailsAdmin、Rubocop、Rspec、i18n 等。

284 stars0 点赞5 次浏览
访问官网GitHub

工具介绍

一个 Rails 6 套件,用于创建您的下一个 SaaS 产品。预装了 graphQL、devise、JWT、CanCanCan、RailsAdmin、Rubocop、Rspec、i18n 等。

Rails 6 boilerplate with devise, JWT, graphQL, CanCanCan and RailsAdmin.

This is a boilerplate to build your next SaaS product. It's a RubyOnRails 6 backend with authentication, GraphQL API, Roles & Ability management and a admin dashboard. It works nicely together with clients made with Angular, React, Vue.js, React.Native, Swift, Kotlin or any other client framework which implements the JSON Web Tokens philosophy.

Versions

  • Current ruby version 2.6.x
  • Bundler version 2.1.4
  • Rails version 6.0.X
  • PostgreSQL Server as db connector

Dependencies

This boilerplate works like a charm with the following gems:

  • pg
  • devise
  • devise_invitable
  • graphql
  • graphql-auth
  • graphql-errors
  • rack-cors
  • rack_attack
  • rails_admin
  • cancancan
  • image_processing
  • mini_magick
  • puma
  • bootsnap
  • friendly_id
  • dotenv

Quick start

You can have a running backend in seconds on heroku: or clone this repo:

bash
git clone https://github.com/zauberware/rails-devise-graphql my-saas-backend
cd my-saas-backend

Clone env_sample to .env for local development. We set it up with default rails 3000 and client 8000 ports:

bash
cp env_sample .env

Install the bundle:

bash
bundle install

Make sure the PostgreSQL is running on localhost. You may have to change your credentials under /config/database.yml:

bash
rake db:create
rake db:migrate
rake db:seed

Run the development server:

bash
rails s

Download a GraphQL client like GraphiQL or others to access and test your API. Point the GraphQL IDE to http://0.0.0.0:3000/graphql

Note: Make sure that the .env file is included in the root of your project and you have defined CLIENT_URL and DEVISE_SECRET_KEY. Read more about the JSON Web Token this. There are plenty of packages available.

What's included?

1. Database

The app uses a PostgreSQL database. It implements the connector with the gem pg. The app already includes a User and a Company model with basic setup. We see an Company as a company with it's users. We did not add multi-tenancy to this app. If you want to do it by yourself check out the apartment gem.

2. Authentication

The app uses devise's logic for authentication. For graphQL API we use the JWT token, but to access the rails_admin backend we use standard devise views, but registration is excluded.

Change devise settings under config/initializers/devise.rb and config/initializers/graphql_auth.rb.

Invitations

Admins of a company can invite new users. The process is handled with devise_invitable. We added a inviteUser and acceptInvite mutation to handle this process via graphql.

Like in the reset password process we redirect the users to the frontend domain and not to backend.

3. JSON Web Token

graphql-auth is a graphql/devise extension which uses JWT tokens for user authentication. It follows secure by default principle.

4. GraphQL

graphql-ruby is a Ruby implementation of GraphQL. Sadly it's not 100% open source, but with the free version allows you amazing things to do. See the Getting Started Guide and the current implementations in this project under app/graphql/.

Filters, Sorting & Pagination

Our BaseResolver class provides everything you need to achieve filter, sorting and pagination. Have a look at the resolver resolvers/users/users.rb:

How to:

Include SearchObject module in your resolver:

ruby
  class Users 

__Author website:__ [https://www.zauberware.com](https://www.zauberware.com)

Issues· 12 开放

查看全部 Issues在 GitHub 打开

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

> 标签

Rubyapi-onlyauthentication-backendboilerplateboilerplate-template

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

> 工具信息

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

> 相关工具

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