app/: Rails app code (controllers, models, views). Authorization policies live inapp/policies/, server-side tables inapp/datatables/.app/javascript/: Frontend assets with Stimulus controllers incontrollers/, entry points inpacks/, and SCSS instylesheets/.config/: App configuration,config/routes/for route splits, andconfig/settings/for environment settings.test/: Minitest suite, includingtest/system/for system tests.public/,db/,lib/: Static assets, database migrations, and shared libraries/tasks.
bin/setup: One-time setup; installs gems, pnpm packages, and prepares the database.bin/rails server: Run the Rails server locally.bin/shakapacker-dev-server: Run the Webpack HMR server (use withbin/rails server).bin/rails db:migrate: Apply migrations; usebin/rails db:rollback STEP=1when needed.pnpm install: Install frontend dependencies.bin/shakapacker: Build production assets.bin/rails test/bin/rails test:system: Run unit/integration tests and system tests.bundle exec standardrb: Lint Ruby code (StandardRB/RuboCop config).bin/brakeman: Run the security scanner before releases.
- Ruby follows StandardRB (2-space indentation, double quotes). Prefer
bundle exec standardrb --fixbefore committing. - Stimulus controllers must be named
*_controller.jsunderapp/javascript/controllers/. - SCSS files generally mirror pack names (e.g.,
dashboard.scssfordashboard.js). - Use snake_case for database columns and Ruby method names.
- Tests live under
test/and use Minitest; system tests use Capybara + Selenium. - Naming:
*_test.rbin the matching folder (e.g.,test/controllers/users_controller_test.rb). - Run focused tests with
bin/rails test test/path/to/file_test.rb. - No explicit coverage threshold is defined; keep new behavior covered.
- Commit messages are short and lowercase without scopes (e.g.,
pnpm upgrade,gem upgrade). - PRs should include a clear description, linked issues, and screenshots for UI changes.
- Ensure CI aligns with local checks:
bundle exec standardrb,bin/rails test, andbin/rails test:system.
- Secrets belong in Rails credentials (
bin/rails credentials:edit), not inconfig/settings/*. - For SCSS debugging, enable HMR in
config/shakapacker.ymlby settinghmr: true. - Keep Stimulus included in packs to avoid Webpack 5 load-order issues.