Rails CLI: rails new
The rails new command builds a complete Rails application skeleton from one command, with defaults that follow convention over configuration. The lessons walk through the generated top-level layout, then the app/ folder where models, views and controllers live, along with helpers, jobs and mailers. They cover config/, including application.rb, the three environment files and encrypted credentials. Flags such as --database, --css, --javascript, --api and --minimal change specific defaults. The last lessons cover the Git repository rails new initializes, the bin/setup script, and one real command traced against every piece.
What you'll learn
- ✓What rails new generates and why its defaults follow convention over configuration
- ✓The top-level layout shared by every Rails app, including public/ and .keep files
- ✓How app/ maps the MVC roles to folders, plus helpers, jobs and mailers
- ✓How config/ controls booting, environments, database settings and encrypted credentials
- ✓Which rails new flags change the database, CSS, JavaScript and stack size
- ✓The Git setup rails new creates and what bin/setup does
What `rails new` generates
Rails MVC overview ended with app/models/article.rb, app/controllers/articles_controller.rb and a view, three files working together. Those files and their folders don't appear on their own. Something has to create app/models/, app/controllers/, app/views/, a Gemfile, database settings, a web…
Read the full lesson free →Curriculum
7 lessonsWhat `rails new` generates
One rails new command creates a working tree of over a hundred wired files, using sensible defaults.
The top-level layout
Every generated app shares one top-level layout, where app/ holds app code and the rest is infrastructure.
Inside app/: where MVC lives
The app/ folder holds models, views and controllers, plus helpers, JavaScript, assets, jobs and mailers.
Inside config/: how Rails boots
The config/ folder sets how the app boots, with environment files, database settings and encrypted credentials.
Choosing your stack: rails new flags
Flags like --database, --css, --javascript, --api and --minimal swap specific defaults and keep the rest.
Day one: Git and bin/setup
rails new initializes Git with Rails-aware ignore rules, and bin/setup prepares gems, database and server.
Putting it together: generating a real app
One rails new command with PostgreSQL and Tailwind flags is traced against every lesson's ideas.