• Stars
    star
    46
  • Rank 613,923 (Top 13 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 3 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Opinionated Rails 7 starter template using esbuild, tailwindcss, postgresql and hotwired tested with RSpec

Rails starter template

rspec standard brakeman bundler_audit

Opinionated Rails setup using Rails 7, PostgreSQL, TailwindCSS, Stimulus, Hotwire and RSpec.

We are bundling JavaScript and CSS through a Node-based setup with jsbundling-rails and cssbundling-rails.

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 (asdf install)
  • Node 19 (asdf install)
  • Bundler (gem install bundler)
  • Yarn (brew install yarn)
  • Overmind (brew install tmux overmind)
  • Postgresql (brew install postgresql start with: brew services start postgresql)
  • Redis (brew install redis start 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 asdf install

The Homebrew dependencies can be installed with running:

brew bundle install --no-upgrade

Additional Homebrew dependencies can be added to the Brewfile

Optional: Docker to use with the preconfigured dip.yml to setup a dockerized dev environment using dip

Getting started

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.

$ bin/setup

Provisioning and interacting with Docker and dip

You need docker and 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

Development

Will run Overmind (or Foreman if Overmind is not installed), builds all assets automaticly and will start the rails server and sidekiq

$ bin/dev

When using dip:

$ dip up web

Code Guidelines

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

For Javascript we use StandardJS.

$ yarn standard

to automatically format the javascript with StandardJS you can run:

$ yarn standard --fix

Running the specs

Inspired by Evil Martians - System of a Test article

To run all the specs you can run:

$ rake

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