skip to content

In Rails 8.1, what does `rails new --minimal` strip from a new app, what does it keep, and how do you bring one piece back?

level: middleimportance: should knowfreq 40%

answer

  1. a meta option that implies skips
  2. about twenty --skip-* implications
  3. Active Record and Propshaft stay
  4. --no-skip-* revokes an implied skip
  5. conflicting options abort the run

basics

~20 s

In Rails 8.1, --minimal implies about twenty --skip-* flags, removing jobs, mailers, storage, Cable, Hotwire, JavaScript, Solid, Kamal, Docker and the lint and audit tools, while keeping Active Record, Propshaft, Puma and Minitest; --no-skip-active-job restores one piece.

solid answer

~40 s

`--minimal` is a **meta option**: it does nothing itself but implies a list of skips, which the generator prints as `--skip-... [due to --minimal]`. In 8.1 that list covers Action Cable, Mailbox, Mailer and Text, Active Job and Active Storage, bootsnap, Brakeman, bundler-audit, GitHub CI, dev gems, Docker, Hotwire, JavaScript, jbuilder, Kamal, RuboCop, Solid, system tests and Thruster. It does **not** skip Active Record, the test framework, git or the asset pipeline, so you still get SQLite, Minitest and Propshaft. Because it is a meta option, `rails new app --minimal --no-skip-active-job` restores Active Job while the other implied skips stay. An explicit flag is different: `--skip-active-job --no-skip-active-storage` aborts with "Cannot proceed due to conflicting options", because an explicit skip's implications cannot be revoked.

go deeper

for a junior

Recall that --minimal removes the optional frameworks and tooling but keeps Active Record, Propshaft, Puma and the test folder.

for a middle

Explain the meta-option mechanism: implied skips, the printed report, --no-skip-* to restore one, and the dependency rules between skips.

for a senior

Judge when a minimal app is the right start and when re-adding Hotwire, jobs and deploy files later costs more than skipping a few pieces now.

for a principal

Weigh a minimal baseline against the full default for a portfolio of services: the cost of divergent stacks versus the cost of unused frameworks.

## What `--minimal` is `rails new --minimal` generates the smallest conventional Rails app: models, controllers, views and tests, without the frameworks and tooling most apps grow into. In the generator's source it is a **meta option**, one whose only effect is to switch other options on. Running it prints the result before any file is written: ```bash $ rails new probe --minimal Based on the specified options, the following options will also be activated: --skip-action-cable [due to --minimal] --skip-bootsnap [due to --minimal] --skip-kamal [due to --minimal] ``` (trimmed; the real list is about twenty lines). ## What it strips in Rails 8.1 | Area | Implied skips | |---|---| | Frameworks | `--skip-action-cable`, `--skip-action-mailbox`, `--skip-action-mailer`, `--skip-action-text`, `--skip-active-job`, `--skip-active-storage` | | Front end | `--skip-javascript`, `--skip-hotwire`, `--skip-jbuilder` | | Infrastructure | `--skip-solid`, `--skip-docker`, `--skip-kamal`, `--skip-thruster`, `--skip-bootsnap` | | Tooling | `--skip-rubocop`, `--skip-brakeman`, `--skip-bundler-audit`, `--skip-ci`, `--skip-dev-gems`, `--skip-system-test` | The list has grown: Rails 8.1 extended it to the newer pieces (Brakeman, CI, Docker, Kamal, RuboCop, Solid and Thruster) and added `--skip-bundler-audit` when `bin/bundler-audit` arrived. An answer based on an older release will name fewer skips. ## What it keeps - **Active Record**, configured for the default `sqlite3` (or whatever `-d` says). - **Propshaft**, because `--skip-asset-pipeline` is not in the list, so `app/assets` still works. - **Minitest** and the `test/` tree, because `--skip-test` is not implied; only system tests go. - **Puma**, `debug` and `tzinfo-data` in the Gemfile, git initialisation and `.keep` files. So `--minimal` is not `--api`. The API preset is a separate, non-meta option that implies `--skip-asset-pipeline` and `--skip-javascript` and sets `config.api_only`; `--minimal` keeps a browser-facing app, just a bare one. ## Bringing one piece back The generator tracks *why* each skip is on. Because `--minimal` is a meta option, its implications can be revoked with a `--no-` flag: 1. `rails new probe --minimal --no-skip-active-job` restores Active Job. Mailer and Storage stay skipped, because `--minimal` still implies them directly. 2. `rails new probe --minimal --no-skip-active-storage` restores Active Storage **and** Active Job, since Storage depends on Jobs; Mailbox and Text stay skipped. 3. `rails new probe --skip-active-job --no-skip-active-storage` **aborts**. An explicitly passed skip is irrevocable, and `--skip-active-job` implies `--skip-active-storage`, so the report prints `ERROR: Conflicts with --no-skip-active-storage` and the generator raises "Cannot proceed due to conflicting options". The same dependency rules apply without `--minimal`: `--skip-active-job` implies skipping Mailer and Storage, `--skip-active-record` implies skipping Storage and Solid, `--skip-active-storage` implies skipping Mailbox and Text, and `--skip-javascript` implies skipping Hotwire. ## When to reach for it - A small internal tool or a proof of concept where every framework is a liability you would delete anyway. - A reproduction app for a bug report, where fewer moving parts make the failure obvious. - Learning, to see what a Rails app is before the extras are layered on. For a product, the defaults usually win: re-adding Hotwire, jobs and the deploy files later costs more than skipping the few you know you do not need. ## Traces it leaves in the generated files - `config/application.rb` lists each railtie with the skipped ones commented out, instead of `require "rails/all"`. - Because system tests are skipped, `config/application.rb` also gets `config.generators.system_tests = nil`, so later scaffolds do not create them. - The Gemfile has no Solid, Kamal, Thruster, bootsnap, Hotwire or lint gems, and it omits the commented `bcrypt` hint that a default app carries. - `bin/` has no `rubocop`, `brakeman`, `bundler-audit` or `thrust` scripts, because the generator excludes them when their tools are skipped.

  • Does `--minimal` give you `config.api_only = true`?
    No. `--minimal` is a meta option that only implies skips; it keeps a browser-facing app with Propshaft and full controllers. The `--api` preset is a separate option that implies `--skip-asset-pipeline` and `--skip-javascript` and writes `config.api_only = true`.
  • Why does `--minimal --no-skip-active-storage` also bring Active Job back?
    Active Storage depends on Active Job for analysis and purging, so the generator records `--skip-active-job` as one reason for `--skip-active-storage`. Revoking Storage revokes the skips that implied it too, as long as those were themselves implied rather than passed explicitly. Mailbox and Text stay skipped, because `--minimal` implies them directly.

  • --minimal skips Active Record, so the app has no database layer.
  • --minimal is the same as --api.
  • --minimal drops the asset pipeline, so there is no Propshaft.
  • Once --minimal is passed, none of its skips can be undone.
  • --minimal removes Minitest and the whole test/ folder.

Assumes Rails 8.1.4; 8.1 extended --minimal to skip Brakeman, CI, Docker, Kamal, RuboCop, Solid, Thruster and bundler-audit.