Rails adds a minimal flag to generate a new application


Before

When we generate a new Rails application, Rails includes all the possible frameworks that are needed to build a modern-day full-stack web application by default.

However, not everyone who’s using Rails needs all of them. For example, if we have an application that does not need Action Cable, Action Mailbox, and Action Text, we would generate a new application, by passing flags to skip these frameworks as shown below:

rails new my_awesome_app --skip-action-text --skip-action-cable \
--skip-action-mailbox

Nonetheless, there are some users, who want a bare minimum version of Rails without all frameworks. It’s not uncommon for some of the minimalists to do something like this:

rails new my_awesome_app --skip-spring --skip-listen --skip-bootsnap \
--skip-action-text --skip-active-storage --skip-action-cable \
--skip-action-mailer --skip-action-mailbox --skip-test \
--skip-system-test --skip-active-job

To go with this approach, one needs to be aware of all of the frameworks that come by default with Rails and skip the unneeded ones.

After

Rails has added an ability to generate a new Rails application with minimal frameworks as below:

  rails new my_awesome_app --minimal 

This will skip all of the frameworks mentioned below and scaffolds a barebones version of Rails application.

- action_cable
- action_mailbox
- action_mailer
- action_text
- active_job
- active_storage
- bootsnap
- jbuilder
- spring
- system_tests
- turbolinks
- webpack

So with the above changes, users will be able to generate a very lightweight application for their use cases.

There are plans to introduce interactive mode of selecting what frameworks we need, with the help of --interactive flag as well when generating a new application.