Getting Started / Installation

Installation

From zero to fully styled scaffolds in a couple of minutes.

Quick start

Starting from scratch? This gives you a complete app with styled scaffolds:

rails new myproject -c tailwind
cd myproject
yarn
bundle add basecoat
rails basecoat:install
rails g scaffold Post title:string! description:text posted_at:datetime active:boolean rating:integer
rails db:migrate
./bin/dev
# open http://localhost:3000/posts

Adding a ! to an attribute (like title:string!) marks the field as required in both the migration and the form.

Existing applications

Basecoat requires Tailwind CSS. If you have not installed it yet, follow the tailwindcss-rails instructions first. Then:

bundle add basecoat
rails basecoat:install

Only run the install task once

It prompts before overwriting any existing file, so your customizations are safe on re-runs — but it is designed as a one-time setup.

What the install task does

  • Installs basecoat-css with your package manager (bun, yarn, npm or pnpm) — or falls back to CDN links if none is detected
  • Pins basecoat-css/all in your importmap and imports it in application.js
  • Adds view transitions for Turbo Frame navigation
  • Copies a Stimulus search_controller.js for the remote search helpers
  • Imports basecoat-css in your Tailwind entry point and appends a few form/validation styles
  • Installs the application layout with sidebar, header, theme toggle, toasts and alerts
  • Adds the theme bootstrap script to _head.html.erb so dark mode persists without flickering
  • Registers a scaffold hook: every rails g scaffold from now on produces Basecoat-styled views and adds a sidebar link

Optional installers

Three more rake tasks style the rest of your app:

rake basecoat:install:devise          # Devise views and layout
rake basecoat:install:authentication  # Rails 8 built-in authentication views
rake basecoat:install:pagy            # Pagy pagination styles

Each has its own page in the Pages section of these docs.