New Rails App Checklist

How I personally start new apps

Create Project

Get the latest version of Rails

gem install rails

Create a new app

rails new <name> -d postgresql --skip-turbolinks

Don’t fret too much over the name - you can easily update it later

Version Control

Add Git

git add .
git commit -m "Hello app"

App Config

Make a few updates to config/application.rb

Disable unwanted generators

config.generators do |g|
  g.assets false
  g.helper false
  g.test_framework nil
end

Set time zone

config.time_zone = "Pacific Time (US & Canada)"

Services

Create a directory for services

mkdir app/services

And create app/services/application_service.rb with:

class ApplicationService
  include Rails.application.routes.url_helpers

  def self.perform(*args)
    new.perform(*args)
  end

  protected

  def default_url_options
    Rails.application.config.action_mailer.default_url_options
  end
end

Templates

Add Haml

gem 'haml-rails'

and run

rake haml:erb2haml

Console

Add Awesome Print

gem 'awesome_print', require: false

and have it run when the console starts in config/application.rb

console do
  require "awesome_print"
  AwesomePrint.irb!
end

Environment

Add dotenv

gem 'dotenv-rails', groups: [:development, :test]

Create an env file and exclude it from version control

touch .env
echo ".env" >> .gitignore

Lastly

Run

rails db:create
rails s

and create something awesome

Published March 30, 2017


You might also enjoy

Adding CSP to Rails

Verify Slack Requests in Rails

Rails on Heroku


All code examples are public domain.
Use them however you’d like (licensed under CC0).