Rails启动器

rails-starter — Rails 启动器模板

作者 roonyx-tech

Rails Starter Kit 是面向 Ruby on Rails 项目的启动模板,预置 docker-compose、Sidekiq、CORS、RSpec 测试与 RuboCop 等常用配置,克隆后即可开始新项目。

看看你的网站会是什么样

浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。

1 个预览视图
桌面端首页
桌面端截图首屏预览

由服务器浏览器实际访问页面后截取。

目前有 1 张原始预览,可打开完整图片查看设计细节。

截图用于了解视觉与布局,交互效果请以实际项目为准。

采集于 2026-10-03查看来源

值得关注的模板亮点

从已有项目资料中,快速了解它的特点。

01

预置 docker-compose 配置,提供 make setup、migrate、rollback、bundle、reset、console 等常用命令

02

集成 Sidekiq 后台任务与 rack-cors 跨域支持

03

内置 RSpec 测试栈,含 factory_bot_rails、faker、shoulda-matchers、database_cleaner 与 simplecov 覆盖率报告

04

集成 RuboCop 静态检查与 rswag API 文档生成

05

提供 ApplicationService 基类,用于编写单一职责的服务对象

06

使用 byebug 调试,可通过 docker attach 接入运行中的容器

模板详细介绍

Rails Starter Kit 由 roonyx-tech 维护,定位是新建 Rails 项目时的起点。它把团队既有 Rails 项目中常见的功能与配置集中到一个仓库里,使用方式是克隆项目、执行重命名命令、再把 git remote 指向自己的仓库,而不是从零搭建。

模板预置了 docker-compose 启动配置、Sidekiq 后台任务、rack-cors 跨域支持,以及 factory_bot_rails、faker、active_model_serializers、byebug、bullet、rspec、rswag、database_cleaner、shoulda-matchers、simplecov、rubocop、annotate 等开发与测试依赖。README 给出了通过 make 目标执行迁移、回滚、bundle、重置数据库、进入 rails console 和运行自定义命令的方式,也说明了 rake ci、rspec、rubocop、rake docs:generate 与覆盖率报告的用法。

使用前需要 Ruby 3.0.2 或更高版本,并具备 Docker 与 docker-compose 环境。模板本身不包含业务逻辑,Application Service 仅提供一个 PORO 基类示例;演示站点 roonyx.tech 是维护方官网,并非该模板的运行示例。仓库采用 MIT 许可,代码可免费使用、修改、商用和分发,但演示图片、字体、图标等第三方素材以及域名、托管、数据库等外部服务需另行核对许可与费用。

Rails启动器

适合你的项目吗?

适用场景

  • 需要快速启动一个新的 Ruby on Rails 项目,并希望沿用已有的 Docker 与测试配置
  • 团队希望统一 Rails 项目的后台任务、跨域、序列化与代码检查方案
  • 为 Rails 项目搭建 RSpec 测试体系并生成 API 文档
  • 在容器化环境中开发 Rails 应用,通过 make 命令完成常见运维操作

适合人群

  • 熟悉 Ruby on Rails 并准备开始新项目的开发者
  • 使用 Docker 与 docker-compose 作为本地开发环境的团队
  • 需要 RSpec、RuboCop、Sidekiq 等常用组件预置配置的 Rails 项目

上手与定制指南

结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。

  1. 1

    环境要求 Ruby 3.0.2 或更高版本,并安装 Docker 与 docker-compose

  2. 2

    克隆仓库后执行 bundle && rails g rename:into YourAppName 重命名应用,再将 git remote 指向自己的仓库

  3. 3

    使用 make setup 构建,docker-compose up 启动,docker-compose down 停止

  4. 4

    数据库迁移、回滚、重置与 rails console 分别通过 make migrate、make rollback、make reset、make console 执行

  5. 5

    代码采用 MIT 许可,分发时需保留版权与许可声明;第三方素材与外部服务需单独核对许可和费用

查看仓库使用说明

授权与来源资料

使用条件与限制

免费使用 · 保留许可声明

本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。

使用时需要遵守

  • 允许免费使用、修改、商用和分发该版本代码。
  • 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
  • 代码按现状提供;担保与责任限制以原许可证及适用法律为准。

额外费用与待核对事项

  • 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
  • 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
查看原文依据

DeepSeek 根据仓库许可证和 README 整理 ·2026-10-03。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。

项目核对记录与介绍依据

模板资料

来源平台
GitHub
资料与维护参考分
资料一般 · 65 / 100
技术栈
Rails
网站类型
启动器
这个分数如何计算

本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。

这个项目需要核对什么

记录的仓库更新时间
2022-06-16
截图检查日期
2026-10-03

已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。

目录记录的主要技术栈是 Rails。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。

查看具体选型方法 →

介绍的制作与核对状态

介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。

审核声明: [email protected] · 2026-10-04

查看当时使用的来源资料

SHA-256: bdf8a1131a40ee71d0059146100d06cf3c6ec28b858612918723c1f3e80f388b

2026-10-03T15:29:02.673Z

来源文件 / 仓库
# About

Rails Starter Kit was created as a way to save time when starting a new Rails project. 
We have taken the most common functionality and configuration in our existing Rails projects, and put those into this project. 
Simply clone this project, and change the git remote to your remote repository. 
Rails Starter Kit is ready to start with docker-compose.

## Table of contents

* [Out-of-the-box functionality](#out-of-the-box-functionality)
* [Getting started](#getting-started)
    * [Init](#init)
    * [Docker build](#docker-build)
    * [Run app](#run-app)
    * [Down app](#down-app)
* [Docker](#docker)
    * [migrate](#migrate)
    * [rollback](#rollback)
    * [bundle](#bundle)
    * [Reset database](#reset-database)
    * [Rails console](#rails-console)
    * [Run custom command](#run-custom-command)
* [Tests, Lints, Docs](#tests-lints-docs)
    * [Running tests](#running-tests)
    * [JSON context in rspec](#json-context-in-rspec)
    * [Running lints](#running-lints)
    * [Generate docs](#generate-docs)
    * [Coverage report](#coverage-report)
* [Additional functionality](#additional-functionality)
  * [Application Service](#application-service)
  * [Debug](#debug)
* [License](#license)

## Out-of-the-box functionality

- [docker-compose](https://docs.docker.com/compose/) configuration for start project
- [Sidekiq](https://github.com/mperham/sidekiq) configuration for background processing
- [rack-cors](https://github.com/cyu/rack-cors) provides support for Cross-Origin Resource Sharing (CORS)
- [factory_bot_rails](https://github.com/thoughtbot/factory_bot_rails) for fixtures
- [faker](https://github.com/faker-ruby/faker) for generates fake data
- [active_model_serializers](https://github.com/rails-api/active_model_serializers/tree/0-10-stable) for serialize json
- [byebug](https://github.com/deivid-rodriguez/byebug) simple to use and feature rich debugger for Ruby
- [bullet](https://github.com/flyerhzm/bullet) for detect N+1 queries
- [rspec](https://github.com/rspec/rspec-rails) testing framework
- [rswag](https://github.com/rswag/rswag) for generate api docs
- [database_cleaner](https://github.com/DatabaseCleaner/database_cleaner) containing strategies for cleaning your database
- [shoulda-matchers](https://github.com/thoughtbot/shoulda-matchers) provides RSpec-compatible one-liners to test common Rails functionality
- [simplecov](https://github.com/simplecov-ruby/simplecov) is a code coverage analysis tool for Ruby
- [rubocop](https://github.com/rubocop/rubocop) static code analyzer (a.k.a. linter)
- [annotate](https://github.com/ctran/annotate_models) for schema comment

## Getting started

Requirements:

- Ruby >= 3.0.2

### Init

1. Clone Rails Starter Kit
2. Execute bundle && rails g rename:into YourAppName
3. Go to ./../YourAppName
4. Create a new repository on GitHub, BitBucket, or your own server 
5. Change the git remote to your new repository
6. Push changes

### Docker build
```
make setup
```

### Run app
```
docker-compose up
```

### Down app
```
docker-compose down
```

## Docker

### Migrate
```
make migrate
```

### Rollback
```
make rollback
```

### Bundle
```
make bundle
```

### Reset database
```
make reset
```

### rails console
```
make console
```

### Run custom command
```
docker-compose run --rm rails bundle exec <your_custom_command>
```

## Tests, Lints, Docs

### Ci task
- To run the CI task run:
```
rake ci
```

### Running tests

- To run the test suite simply run:
```
rspec
```

### JSON context in rspec
- Setup json helper in your spec file
```ruby
include_context :json
```
- And easy use json in expect
```ruby
expect(json).not_to eq []
```

### Running lints

- To run rubocop lint
```
rubocop
```

- Auto correct rubocop lint
```
rubocop -a
```

### Generate docs

```
rake docs:generate
```

### Coverage report

After call `rspec` will be in the `./coverage` folder

## Additional functionality

### Application Service

Service objects are Plain Old Ruby Objects (PORO) that are designed to execute one single action in your domain logic and do it well.

- Example service object
```ruby
class ExampleService < ApplicationService
  attr_reader :name
  
  def initialize(name)
    @name = name
  end
  
  def call
    puts "Hello #{name}"
  end
end
```
- For call object
```ruby
ExampleService.call('name')
```

### Debug
Setup `byebug` in your code, then attach to running container:
```
docker attach [rails_container_id]
```
- `Ctrl+D` to the next point
- `continue` to finish debug
- `Ctrl+P` then `Ctrl+Q` to detach container


## License

[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/roonyx-tech/rails-starter/blob/master/LICENSE)
反馈内容错误

看看同类模板

对比同技术栈与用途的模板,找到更适合的视觉与内容结构。