Creating an App and Its Folders
One command gives you a working web app: a server that starts, a database that connects and a welcome page. The command is rails new. What it leaves behind is a set of folders, and knowing their jobs is half of knowing Rails.
The rule
Your code in app, settings in config, data shape in db.
rails new bookclub
cd bookclub
bin/rails serverrails new creates the project, writes a Gemfile and runs bundle install. bin/rails server starts the Puma web server at http://localhost:3000. The defaults in Rails 8 are SQLite for the database, Hotwire for interactivity and Importmap for JavaScript, so there is no build step to set up. Flags change the defaults, for example rails new bookclub --database=postgresql.
The folders that matter first:
| Path | Job |
|---|---|
app/ |
Your code: models, views, controllers, helpers, javascript, assets, jobs, mailers |
config/ |
Settings: routes.rb, database.yml, environments/, credentials |
db/ |
migrate/ (schema changes), schema.rb (current shape), seeds.rb (starter data) |
bin/ |
Scripts you run: bin/rails, bin/setup, bin/dev |
public/ |
Static files served as-is, such as 404.html and robots.txt |
Gemfile |
The gems (libraries) the app depends on; Gemfile.lock pins exact versions |
You will also see test/ for tests, log/ for log files and tmp/ for caches.