Forge is a Rails application template that installs common tools and performs common configurations to avoid repetition
- Rails (
gem install rails
)
This has been tested with the newest Rails version at the time of writing, which is 7.1.3
Recommended previous step (RVM)
Use RVM or a similar Ruby version manager and isolate this app to its own gemset. With RVM, you can do this by adding .ruby-version
and .ruby-gemset
files in a new folder. If you do this, instead of calling rails new YOUR_APP_NAME
, you can use rails new .
in the command below.
# -d postgresql uses PostgreSQL instead of SQLite. It will be configured as expected.
# -T skips tests, since we will include RSpec.
rails new YOUR_APP_NAME -d postgresql -T -m https://raw.githubusercontent.com/higo-app/forge/main/lib/template.rb
# In your app's root folder
bin/rails app:template LOCATION=https://raw.githubusercontent.com/higo-app/forge/main/lib/template.rb
# In your app's root folder, for example if we only want to add Redis config
bin/rails app:template LOCATION=https://raw.githubusercontent.com/higo-app/forge/main/lib/settings/redis.rb
pg
: Connects to a Postgres database. Configures a minimalisticconfig/database.yml
and, optionally, configures UUID primary keys.redis
: Adds dependency and a singleconfig/redis/shared.yml
configuration, to be used by ActionCable, Kredis, Sidekiq, etc.sidekiq
: Background jobsstrong_migrations
: Catches unsafe DB migrationssentry-ruby
: Error reporting. Adds and configures dependency. Also includessentry-rails
andsentry-sidekiq
.analytics-ruby
: Segment analytics (customer data platform). Adds and configures dependency.devise
(Optional): Adds dependency, runs initializer, changes a couple of configurations, adds translations and optionally adds flashes to the application layout and a static page as a root path.tailwindcss-rails
(Optional): Adds dependency and runs initializer- Add
Procfile
(web
,worker
andrelease
processes) andProcfile.dev
(web
andworker
processes, although tailwind may also add acss
process). Also includesbin/dev
which runsProcfile.dev
withforeman
- Add
staging
environment (copy fromproduction
) - Compress (gzip) responses with
Rack::Deflater
in production and staging. - Changes default
from
(i.e. sender) inApplicationMailer
- Allows adding I18n available and default locales (from svenfuchs/rails-i18n)
- Allows configuring hosts / default URL options for all environments
- Populates
README.md
brakeman
: Find security vulnerabilities in your app (added to GH workflow)bundler-audit
: Find vulnerable dependencies (added to GH workflow)rubycritic
: Enforce a good quality codebase (added to GH workflow)factory_bot_rails
: Simplifies record building/creating in testsrspec-sidekiq
: For Sidekiq testing.shoulda-matchers
: Simplifies common testsrspec-rails
: For tests. Includes, initializes the dependency (without AR fixtures, with transactional fixtures). Integrates withfactory_bot_rails
,rspec-sidekiq
andshoulda-matchers
rubocop-rails
: Adds and configures this dependency, along with extensionsrubocop-performance
,rubocop-rspec
,rubocop-factory_bot
- Github:
- Add Dependabot configuration:
.github/dependabot.yml
configures weekly updates, groups development dependencies (i.e. the ones indevelopment
andtest
groups) and sentry gems - Add PR template
- Workflows:
test
: Runs test suite withrspec
code_analysis
: Runsbundle-audit
,rubocop
,brakeman
,rubycritic
- Add Dependabot configuration: