A Rails Application Template with my preferred setup:
- An empty initial commit
- My preferred EditorConfig:
- UTF-8 encoding
- Unix line endings
- Trailing newline on last line
- Trim trailing whitespace
- 2 spaces indentation in most files (common in Ruby projects)
- 4 spaces indentation in plain-text files (necessary for Markdown)
- Docker environment
- Dockerfile based on official Ruby image, with Node and Yarn
- Docker Compose development environment with official Postgres image
- Pre-commit hook to run linters, with no dependencies other than the shell
- Run against the state in the index, excluding uncommited changes
- Check filenames for invalid patterns
- Enforce
.yml
over*.yaml
- Prevent capital letters in filenames
- Enforce
- Check files for whitespace errors and merge conflict markers
actionlint
: GitHub Actions workflow linterhadolint
: Dockerfile linterv8r
: JSON schema validationrubocop
: Ruby style guide lintershellcheck
: Shell script linterstylelint
: CSS and SCSS linteryamllint
: YAML file linter
- GitHub Actions for linting and testing on push
- Ruby version management with Bundler and
.ruby-version
- Consistency with version requirement in Gemfile
- Configure Bundler to cache gems locally, to allow offline install
- For M1/Silicon macOS and x86_64 Linux architectures (as I use)
- Rails add-ons
- ActiveDecorator: Presenter pattern implementation
- GoodJob: Postgres-based backend for ActiveJob
- Gretel: Helper to show navigation breadcrumbs
- Lograge: Improved defaults to improve Rails logging
- Pagy: Pagination for collections of items in Ruby
- PaperTrail: Track changes to models for auditing or versioning
pgcli-rails
: Replaces Rails PostgreSQLdbconsole
withpgcli
- Pundit: Authorization framework to manage permissions
- Rails Admin: Admin dashboard and data management, in a Rails engine
- Rodauth: Authentication framework to manage user accounts
rodauth-rails
: Rails integration for Rodauthruby-argon2
: Better key derivation function thanbcrypt
- Sorbet: Static type checking for Ruby
- Tapioca: Generate RBI files for gems and DSLs
- Propshaft: Simplified asset pipeline for Rails 7
- PostCSS: CSS preprocessor framework
- Tailwind CSS: Utility-based CSS framework
- Autoprefixer: Adds vendor prefixes to CSS based on Can I Use...
- Font Awesome: Icon library
- Testing
- Factory Bot: Fixture objects for test data
factory_bot_rails
: Factory Bot integration for Rails models
- Faker: Generates plausible/realistic data for addresses, names, etc.
- Pry: Developer console for Ruby, better replacement for
irb
pry-rails
: Use Pry forrails console
- RSpec: Readable testing framework for Ruby
rspec-its
: Helper methodits
to test properties ofsubject
rspec-rails
: Replace Minitest in Rails with RSpec- Shoulda Matchers: Simple one-liner tests for Rails
- Factory Bot: Fixture objects for test data