A concise checklist for boot-strapping a modern Rails 7 application with Postgres, Tailwind, ESBuild, RuboCop, Solargraph, Sentry, Lograge + Ougai, and sensible defaults for CI/CD and local development.

Prerequisites

Tool Recommended Version Notes
Ruby Latest stable (use rbenv) rbenv install <version>
Rails Latest 7.x gem install rails
PostgreSQL ≥ 14 Ensure local service is running
Node.js ≥ 20 Needed for ESBuild & Tailwind
Yarn ≥ 1.x Optional but handy
Docker + docker-compose Latest Required for dev-container & CI

Generate a New Project

rails new <project_name> \
  --css=tailwind \
  --javascript=esbuild \
  --database=postgresql
cd <project_name>

We prefer ESBuild over importmap for now because it offers faster rebuilds and first-class NPM ecosystem support.

Code Style & Static Analysis

Note (Why Shopify + Rails cops?) rubocop-rails covers general Rails best practices, while rubocop-shopify adds pragmatic rules used in large-scale production apps.

  1. Add the gems

    bundle add rubocop-shopify rubocop-rails
    
  2. Move them to development, :test group

    group :development, :test do
      gem "rubocop-rails", "~> 2.24", require: false
      gem "rubocop-shopify", "~> 2.15", require: false
    end
    
  3. Create a baseline config

    bundle exec rubocop --auto-gen-config
    
  4. Optional – add RuboCop to pre-commit hooks with lint-staged or Lefthook.

Editor IntelliSense (Solargraph)

Heads-up — Solargraph relies on the Language Server Protocol to deliver autocompletion, docs, and type inference.

gem install solargraph   # intentionally *not* in Gemfile

.solargraph.yml

include:
  - "**/*.rb"
exclude:
  - spec/**/*
  - test/**/*
  - vendor/**/*
  - ".bundle/**/*"

domains: []
reporters:
  - rubocop
max_files: 5000

config/solargraph_definitions.rb

(Keep exactly as you provided; truncated for brevity)

Application Configuration

Timezone

# config/application.rb
config.time_zone = "UTC"

Serve Static Files in Production

# config/environments/production.rb
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?

.editorconfig

root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

Dev Container (VS Code Remote Containers)

Why? Reproducible onboarding: git clone, “Re-open in Container”, and you’re ready.

.devcontainer/
├─ Dockerfile
└─ devcontainer.json

Dockerfile

FROM ruby:3.3

# Install OS deps
RUN apt-get update -qq && \
    apt-get install -y --no-install-recommends \
      build-essential libpq-dev nodejs yarn git

# Add Node (if you want a newer LTS via nvm, do it here)

# Set workdir
WORKDIR /workspace

# Install bundler & clean up
RUN gem install bundler && \
    apt-get clean && rm -rf /var/lib/apt/lists/*

devcontainer.json

{
  "name": "Rails 7 Dev",
  "build": { "dockerfile": "Dockerfile" },
  "runArgs": ["--env-file", ".env"],
  "forwardPorts": [3000, 5432],
  "postCreateCommand": "bundle install && yarn install --check-files",
  "remoteUser": "root",
  "features": {
    "ghcr.io/devcontainers/features/docker-in-docker:2": {},
  },
}

Bitbucket Pipelines CI

Goal: Lint, test, build assets, and run migrations on every push.

# bitbucket-pipelines.yml
image: ruby:3.3

options:
  size: 2x # give us 8 GB RAM

pipelines:
  default:
    - step:
        name: "Run RuboCop & RSpec"
        caches:
          - bundler
          - node
        script:
          - apt-get update && apt-get install -y libpq-dev nodejs yarn
          - bundle install --jobs 4 --retry 3
          - yarn install --check-files
          - bundle exec rubocop
          - bundle exec rspec

Extend with deploy steps or parallel test splitting as needed.

Host Whitelisting in Development

# config/environments/development.rb
config.hosts.clear  # allows ngrok / Cloudflare Tunnel etc.

Database Config

# config/database.yml
default: &default
  adapter: postgresql
  encoding: unicode
  pool: <%= ENV.fetch("RAILS_MAX_THREADS", 5) %>

development:
  <<: *default
  url: <%= ENV["DATABASE_URL"] %>

test:
  <<: *default
  url: <%= ENV["DATABASE_TEST_URL"] %>

production:
  <<: *default
  url: <%= ENV["DATABASE_URL"] %>

Environment Variables with dotenv-rails

bundle add dotenv-rails
  1. Ignore real secrets

    .env
    
  2. Generate .env.template

    dotenv -t .env
    

Error Monitoring (Sentry)

bundle add sentry-ruby sentry-rails sentry-sidekiq

config/initializers/sentry.rb(your snippet preserved)

Custom Healthcheck

File: config/initializers/00_up.rb(your snippet preserved)

Use /up in production for load-balancer checks.

Structured Logging (Lograge + Ougai)

bundle add lograge ougai

Library code, custom formatter, and controller helpers remain the same as in your draft; ensure you replace HiBroadcaster with your own top-level module.

Quick Smoke Test

rails db:create db:migrate
bin/dev   # or foreman start

Open http://localhost:3000 – you should see your new app styled with Tailwind, ESBuild compiling, and Postgres connected.

That’s it! You now have a robust, opinionated Rails 7 starter template with modern tooling, CI/CD, and production-ready observability.