rails new: Complete Guide to All Options
Every time I run the rails new
command I try to remember what options I prefer - of course, you can change things later, but if you’re looking to get up and running quickly it’s nice to get it mostly correct on the first try. I did an audit of all the options as of rails 8.0.2
and grouped them in a way that made sense to me, since the default output provided by rails new --help
can be difficult to parse through.
Options You Definitely Want to Specify
--database=DATABASE
specifies the database adapter to use. The options are sqlite3
, postgresql
, mysql
, oracle
, sqlserver
, jdbc
, and none
. The default is sqlite3
.
--javascript=JAVASCRIPT
tells Rails which JavaScript bundler or integration to set up for your new application. The possible values are importmap
, bun
, webpack
, esbuild
, and rollup
. The default is importmap
.
--css=CSS
tells Rails which CSS processor to use for your new application. The possible values are tailwind
, bootstrap
, bulma
, postcss
, and sass
. The default is tailwind
.
Options To Skip Components You Don’t Need
--skip-action-mailer
tells Rails not to include Action Mailer in your new app. This means Rails will not generate any email-related folders like app/mailers
, not configure default mailer settings in config/environments/*
and not include action_mailer
in config/application.rb
.
--skip-action-mailbox
tells Rails not to include Action Mailbox in your new application. Action Mailbox is a Rails framework that lets your application receive inbound emails and process them as part of your business logic.
--skip-action-text
tells Rails not to include Action Text in your new application. Action Text is a built-in Rails framework for rich text content, powered by the Trix editor. It allows users to write formatted text and embed images and attachments.
--skip-active-record
tells Rails not to include Active Record, the built-in ORM (Object-Relational Mapping) framework. This is probably the trickiest option to add later on if you decide to skip it at first.
--skip-active-job
tells Rails not to include Active Job, the framework Rails provides for background job abstraction.
--skip-active-storage
tells Rails not to include Active Storage, the built-in framework for file uploads and attachments. If you choose to skip it at first you can add it later with bin/rails active_storage:install
.
--skip-action-cable
tells Rails not to include Action Cable, which is Rails’ built-in framework for WebSockets and real-time communication.
--skip-asset-pipeline
tells Rails not to include any asset pipeline, meaning it won’t set up tools to manage and compile JavaScript, CSS, or images.
--skip-javascript
tells Rails not to set up any JavaScript tooling or files in your new application. By default Rails adds package.json
, app/javascript/application.js
, JavaScript helpers like @hotwired/turbo-rails
and @rails/ujs
and the relevant config based on your JavaScript approach (see --javascript=JAVASCRIPT
).
--skip-hotwire
tells Rails not to include Hotwire, the default real-time frontend stack introduced in Rails 7. This includes Turbo
and Stimulus
.
--skip-jbuilder
tells Rails not to include Jbuilder, which is the default JSON response templating library in Rails. Jbuilder lets you build JSON responses using Ruby in .json.jbuilder
templates. To add it later you simply add it to your Gemfile and run bundle install
.
--skip-test
tells Rails not to generate the default test framework, which is Minitest, and to skip creating test files entirely. This will exclude minitest
from the Gemfile, skip creating the test
folder, and also not generate test files if you’re using rails generate controller/model
. Use it if you’re using RSpec or another test framework
--skip-system-test
tells Rails not to set up system tests, which are end-to-end browser-based tests using Capybara. This option skips generating the test/system
folder, application_system_test_case.rb
, and does not configure Capybara or install any system test drivers. --skip-test
implies that system tests will also be skipped, so --skip-system-test
is redundant unless used alone.
--skip-bootsnap
tells Rails not to include Bootsnap, which is a performance optimization library that speeds up boot time by caching expensive operations.
--skip-dev-gems
is a new option in Rails 8 and tells Rails to omit development-specific gems from the generated application’s Gemfile. These gems are typically included to enhance the development experience but are not necessary for production environments, e.g. web-console
and listen
.
--skip-thruster
is a new option in Rails 8 and tells Rails to exclude the setup for Thruster, a new HTTP/2 proxy.
--skip-rubocop
tells Rails not to include the RuboCop gem and .rubocop.yml
configuration file. In Rails 7.2, the rails new
command began including RuboCop by default in newly generated applications.
--skip-brakeman
tells Rails not to include Brakeman, a static analysis security scanner for Ruby on Rails applications. Brakeman scans your Rails codebase for potential security vulnerabilities — without needing to run the app or its tests. It’s commonly used in CI pipelines or local development to catch problems early.
--skip-ci
tells Rails not to create the GitHub Actions CI workflow in .github/workflows/ci.yml
. By default this Workflow runs tests and Rubocop.
--skip-kamal
tells Rails to exclude the default setup for Kamal, a deployment tool integrated into Rails to simplify application deployment. To add it later you add it to your Gemfile, run bundle install
, and then bin/kamal init
.
--skip-solid
allows you to exclude the default setup for Solid components, which include Solid Cache
(A caching backend that stores cached data in the database), Solid Queue
(A database-backed job queue system that serves as the default Active Job backend), and Solid Cable
(A database-backed Action Cable adapter for real-time features).
--skip-docker
tells Rails to skip generating the docker config like Dockerfile
and bin/docker-entrypoint
. By default Rails will not generate the docker config, but this guards against a template or future config change enabling it by default. There is also a --docker
option, but it’s not listed in rails new --help
, because it’s considered an internal or ‘hidden’ option right now.
--devcontainer
, --no-devcontainer
, and --skip-devcontainer
control whether a Dev Container configuration is generated for Visual Studio Code’s Remote - Containers / Dev Containers feature. --no-devcontainer
and --skip-devcontainer
are synonyms. By default Rails will not generate Dev Containers.
Options For the Generator Itself
--skip-collision-check
tells Rails to overwrite existing files. By default, Rails will refuse to overwrite existing files like Gemfile
, .gitignore
, etc.
--ruby=PATH
changes the shebang (#!
) at the top of generated scripts like bin/rails
and bin/rake
. The default is #!/usr/bin/env ruby
.
template=TEMPLATE
allows you to specify a custom Ruby script that will run during project generation. It allows you to automate additional setup steps, like adding gems that you always include (devise
, rubocop
, standardrb
, etc) and run generators. TEMPLATE
can be a path to a file or a remote URL.
--skip-git
tells Rails to skip all the git
commands after generating the new app. By default Rails will run git init
, stage all the files with git add .
and make an initial commit. This option also skips the .gitignore
file.
--skip-keeps
means Rails won’t create any .keep files — so empty folders will truly be empty. That means they may be missing from Git until something is added.
--rc=RC
lets you specify a file path for load additional options for the rails new
command. By default, Rails looks for a .railsrc
file in your home directory (~/.railsrc
). If you want to prevent Rails from loading any .railsrc
file, you can use the --no-rc
option.
--skip-bundle
tells Rails not to run bundle install automatically after generating the new app.
--skip-decrypted-diffs
tells Rails not to setup a Git filter to show decrypted diffs for credential files. Rails uses encrypted credentials (like config/credentials.yml.enc
) to securely store sensitive information. By default, Rails can configure Git to automatically show the decrypted contents of these files when viewing diffs, making it easier to see what has changed.
Grouped Options
--api
, --no-api
, and --skip-api
control whether the generated application is a full-stack Rails app or a lightweight API-only app. API-only apps are optimized for serving JSON and exclude views, helpers, assets, and various other behaviors not typically needed in API-only applications. By default Rails assumes you are building a full-stack application, so equivalent to --non-api
.
--minimal
creates a lightweight Rails application by excluding several default frameworks and tools. This applies several of the --skip-*
options and excludes components such as Active Job, Action Mailer, Action Mailbox, Active Storage, Action Text, Action Cable, JavaScript, Hotwire, Jbuilder, System tests, Bootsnap, Development gems, Brakeman, Rubocop, CI configuration files, Docker setup, Kamal, Solid components, and Thruster. By default Rails assumes you are building a non-minimal application, so equivalent to --non-minimal
.
Options You Will Probably Never Use
--dev
, --no-dev
, and --skip-dev
are special internal flags meant for Rails contributors or advanced users working on Rails itself. This allows you to tell Rails to generate the app using the local checkout of the Rails framework, instead of pulling gems from rubygems.org.
--edge
, --no-edge
, and --skip-edge
control whether the newly generated application uses the edge branch/version of Rails through configuration in the Gemfile. --no-edge
/ --skip-edge
are aliases that explicitly say: ‘don’t use edge Rails.’ They’re rarely needed unless you’re overriding an inherited or default behavior. Similarly, the --master
, --main
, --no-main
, and --skip-main
control the same behavior, but for pointing at the main
branch.
Options for Engines and Plugins
--skip-namespace
is used when generating engines or plugins, not during normal app creation. So if you’re doing rails new myapp
then it does nothing. If you’re generating a plugin, i.e. rails plugin new my_plugin
by default, Rails namespaces everything under the plugin name — so MyPlugin::Engine
, MyPlugin::ApplicationController
, etc. This options allows you to skip that.
--name=NAME
is used with the rails plugin new
and rails engine new
generators - and not with normal app creation. It sets the internal Ruby module/class name for the plugin or engine independent of the directory name.
My Default Options
Here are my default options for rails new
:
rails new my_app \
--database=postgresql \
--javascript=esbuild \
--css=bootstrap \
--skip-action-mailbox \
--skip-action-text \
--skip-action-cable \
--skip-jbuilder \
--skip-test \
--skip-thruster \
--skip-kamal \
--skip-solid \
--skip-decrypted-diffs
--skip-test
because I generally userspec
, notminitest
.--skip-jbuilder
since I can easily add it if I need it later on.--skip-solid
because I only really use Solid Queue, so I install that separately.--skip-kamal
because I generally deploy to Heroku. For the same reason, I also--skip-decrypted-diffs
, since I prefer to use Heroku environment variables for credentials.
I want to look into the --template
option, since that seems like a great way to add all the other defaults that I can’t configure from rails new
, such as standardrb
and rspec
.