A comprehensive Rails application template with modern best practices, testing tools, and development utilities.
- PostgreSQL database
- RSpec for testing
- StandardRB for Ruby linting
- Bootstrap CSS support (with
--css=bootstrap
) - Esbuild for JavaScript (with
--javascript=esbuild
)
- pry-rails - Enhanced Rails console
- better_errors + binding_of_caller - Better error pages with REPL
- amazing_print - Pretty-print Ruby objects (replaces deprecated awesome_print)
- bullet - N+1 query detection
- goldiloader - Automatic N+1 prevention
- rack-mini-profiler - Performance profiling
- RSpec Rails with proper configuration
- Capybara + Selenium for system testing
- Factory Bot for test factories
- Shoulda Matchers for one-liner tests
- Faker for test data generation
- SimpleCov for code coverage reporting
- WebMock for HTTP request stubbing
- action_dispatch-testing-integration-capybara - Enhanced Capybara integration
- StandardRB + Standard-Rails for Ruby
- Prettier for JavaScript/CSS formatting
- ESLint with Thoughtbot configuration
- Stylelint with Thoughtbot configuration
- erb_lint + better_html for ERB template linting
- AnnotateRb - Automatic model schema annotations (replaces deprecated annotate gem)
- Rails ERD - Entity relationship diagram generation
- rails_db - Web UI for database browsing
- Brakeman - Security vulnerability scanning
- bundler-audit - Check for vulnerable gem dependencies
- strong_migrations - Catch unsafe migrations before they run
- dotenv - Environment variable management (replaces dotenv-rails)
- Force SSL in production
- Enhanced production logging
- Optional UUID primary keys
- Comprehensive README template
- CONTRIBUTING.md guidelines
- .env.example with common configurations
- .node-version for Node.js version management
rails new my_app \
--database=postgresql \
--javascript=esbuild \
--css=bootstrap \
--skip-test \
--skip-kamal \
--skip-rubocop \
--template=https://raw.githubusercontent.com/firstdraft/rails_application_template/main/template.rb
--database=postgresql
- Use PostgreSQL (required)--javascript=esbuild
- Fast JavaScript bundling--css=bootstrap
- Bootstrap CSS framework--skip-test
- Skip Minitest (we use RSpec)--skip-rubocop
- Skip default RuboCop (we use StandardRB)--skip-kamal
- Skip Kamal deployment (unless you need it)
During setup, the template will prompt you for:
- UUID Primary Keys: Choose between standard integers or UUIDs for primary keys
- RSpec with random test order
- Test example persistence for re-running failed tests
- SimpleCov for coverage (run with
COVERAGE=true bundle exec rspec
) - WebMock configured with Chrome driver whitelisting
- Factory Bot and Shoulda Matchers support files
- StandardRB configuration for Ruby
- Prettier, ESLint, and Stylelint for frontend code
- ERB linting with better_html
- All with proper ignore patterns and configurations
- Bullet enabled with console and footer output
- Strong Migrations with sensible timeouts
- AnnotateRb configuration for model annotations
- Rails ERD with Bachman notation
- Incremental commits after each configuration step
- Clean git history showing the setup progression
After creating your app, these commands are available:
bin/dev # Start development server
rails console # Enhanced console with Pry
bundle exec rspec # Run test suite
COVERAGE=true bundle exec rspec # Run with coverage report
# Ruby
bundle exec standardrb # Check Ruby code
bundle exec standardrb --fix # Fix Ruby issues
# JavaScript/CSS
yarn lint # Check JS/CSS
yarn fix:prettier # Fix JS/CSS formatting
# ERB Templates
bundle exec erb_lint --lint-all # Check ERB
bundle exec erb_lint --lint-all --autocorrect # Fix ERB
bundle exec brakeman # Security scan
bundle exec bundle-audit check # Check for vulnerable gems
bundle exec erd # Generate ERD diagram
bundle exec annotaterb models # Update model annotations
Visit /rails_db
in development for web UI
The template uses Rails 8's default Solid Queue for background job processing. For high-volume applications that need Redis-backed processing, see:
This template creates apps configured for generic production deployment, suitable for:
- Render.com
- Fly.io
- Railway
- Heroku (with minor adjustments)
- Any modern hosting platform
This is an enhanced version of the original firstdraft template with:
- Updated gems (amazing_print instead of awesome_print, annotaterb instead of annotate, dotenv instead of dotenv-rails)
- Additional testing tools (SimpleCov, WebMock, Shoulda Matchers, Faker)
- Full linting stack (Prettier, ESLint, Stylelint, erb_lint)
- Security tools (bundler-audit, strong_migrations)
- Performance tools (goldiloader, rack-mini-profiler)
- Modern production configuration (generic instead of Heroku-specific)
- Comprehensive documentation
Pull requests are welcome! Please ensure any new gems or configurations:
- Are actively maintained
- Add clear value for most Rails applications
- Include appropriate documentation
- Follow the incremental commit pattern
MIT