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.
- Out-of-the-box functionality
- Getting started
- Docker
- Tests, Lints, Docs
- Additional functionality
- License
- docker-compose configuration for start project
- Sidekiq configuration for background processing
- rack-cors provides support for Cross-Origin Resource Sharing (CORS)
- factory_bot_rails for fixtures
- faker for generates fake data
- active_model_serializers for serialize json
- byebug simple to use and feature rich debugger for Ruby
- bullet for detect N+1 queries
- rspec testing framework
- rswag for generate api docs
- database_cleaner containing strategies for cleaning your database
- shoulda-matchers provides RSpec-compatible one-liners to test common Rails functionality
- simplecov is a code coverage analysis tool for Ruby
- rubocop static code analyzer (a.k.a. linter)
- annotate for schema comment
Requirements:
- Ruby >= 3.0.2
- Clone Rails Starter Kit
- Execute bundle && rails g rename:into YourAppName
- Go to ./../YourAppName
- Create a new repository on GitHub, BitBucket, or your own server
- Change the git remote to your new repository
- Push changes
make setup
docker-compose up
docker-compose down
make migrate
make rollback
make bundle
make reset
make console
docker-compose run --rm rails bundle exec <your_custom_command>
- To run the CI task run:
rake ci
- To run the test suite simply run:
rspec
- Setup json helper in your spec file
include_context :json
- And easy use json in expect
expect(json).not_to eq []
- To run rubocop lint
rubocop
- Auto correct rubocop lint
rubocop -a
rake docs:generate
After call rspec
will be in the ./coverage
folder
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
class ExampleService < ApplicationService
attr_reader :name
def initialize(name)
@name = name
end
def call
puts "Hello #{name}"
end
end
- For call object
ExampleService.call('name')
Setup byebug
in your code, then attach to running container:
docker attach [rails_container_id]
Ctrl+D
to the next pointcontinue
to finish debugCtrl+P
thenCtrl+Q
to detach container