rails-new
Create a new Ruby on Rails application
TLDR
Create a new Rails application
SYNOPSIS
rails new appname [**--database**=adapter] [**--api**] [**--skip-***] [options_]
DESCRIPTION
rails new creates a new Ruby on Rails application with the standard directory structure, configuration files, and dependencies. It generates everything needed to start developing a web application immediately.
The command creates directories for models, views, controllers, tests, and configurations. It initializes a Gemfile with common dependencies, sets up database configuration, and optionally initializes a git repository.
Rails applications follow convention over configuration. The generated structure establishes conventions that other Rails commands and the framework expect, enabling features like automatic routing and model discovery.
PARAMETERS
--database, -d adapter
Preconfigure for selected database (sqlite3, mysql, postgresql, oracle, sqlserver, etc.)--api
Create an API-only application (smaller middleware stack, no views)--skip-git
Skip git init and .gitignore generation--skip-docker
Skip Dockerfile and related files--skip-action-mailer
Skip Action Mailer files--skip-action-mailbox
Skip Action Mailbox gem--skip-action-text
Skip Action Text gem--skip-active-record
Skip Active Record files (for non-database apps)--skip-active-storage
Skip Active Storage files--skip-action-cable
Skip Action Cable files--skip-asset-pipeline
Skip asset pipeline--skip-javascript
Skip JavaScript files--skip-hotwire
Skip Hotwire integration--skip-jbuilder
Skip jbuilder gem--skip-test
Skip test files--skip-bundle
Don't run bundle install--css processor
Choose CSS processor (tailwind, bootstrap, bulma, postcss, sass)--javascript bundler
Choose JavaScript bundler (importmap, bun, webpack, esbuild, rollup)--template, -m path
Apply an application template from a path or URL--force, -f
Overwrite files that already exist--pretend, -p
Run but do not make any changes--quiet, -q
Suppress status output
CAVEATS
The rails new command is typically run outside of any existing Rails application directory. Running it inside an existing Rails app may cause conflicts.
The default database is SQLite, which is suitable for development but not recommended for production. Specify a production-ready database with --database when creating applications intended for deployment.
Bundle install runs automatically unless --skip-bundle is specified. This can take time on first run as gems are downloaded and compiled.
