Rails starter template
Opinionated Rails setup using Rails 7, PostgreSQL, TailwindCSS, Stimulus, Hotwire and RSpec.
If you want to run
propshaft as the asset pipeline you can use this branch: https://github.com/peterberkenbosch/rails-starter-template/tree/propshaft. The main branch will be using Sprockets for the time being.
You need the following installed:
- Ruby >= 3 (
- Node 19 (
- Bundler (
gem install bundler)
- Yarn (
brew install yarn)
- Overmind (
brew install tmux overmind)
- Postgresql (
brew install postgresqlstart with:
brew services start postgresql)
- Redis (
brew install redisstart with:
brew services start redis)
If you are using asdf (I recommend that you do :) ) you can install the required Ruby and NodeJS versions with
The Homebrew dependencies can be installed with running:
brew bundle install --no-upgrade
Additional Homebrew dependencies can be added to the
Initial application setup
Run the setup script that will run the needed setup steps for the application, installing all gems and packages, database preparing etc.
Provisioning and interacting with Docker and dip
docker-compose installed (for MacOS just use official app).
This app uses the dip CLI, a utility CLI tool for straightforward provisioning and interactions with applications configured by docker-compose.
$ gem install dip $ dip provision
Take a look at the
dip.yml file for the available commands
Will run Overmind (or Foreman if Overmind is not installed), builds all assets automaticly and will start the rails server and sidekiq
When using dip:
$ dip up web
It uses StandardRB for Ruby to automatically fix code style offenses.
$ bundle exec standardrb
to automatically format Ruby with StandardRB you can run:
$ bundle exec standardrb --fix
$ yarn standard
$ yarn standard --fix
Running the specs
Inspired by Evil Martians - System of a Test article
To run all the specs you can run:
or use RSpec directly with
$ bundle exec rspec
Inside the docker container we have 2 different commands. To just run the unit tests:
$ dip rspec
and to just run the system specs:
$ dip rspec system