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
What the install task does
- Installs
basecoat-csswith your package manager (bun, yarn, npm or pnpm) — or falls back to CDN links if none is detected - Pins
basecoat-css/allin your importmap and imports it inapplication.js - Adds view transitions for Turbo Frame navigation
- Copies a Stimulus
search_controller.jsfor 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.erbso dark mode persists without flickering - Registers a scaffold hook: every
rails g scaffoldfrom 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.