Skip to main content

Installation

Add Catalyst to an existing Rails app and mount it at /admin.

Requirements​

RequirementVersion
Ruby3.3 or later
Rails8.0 or later
Node.jsNeeded at build time: assets:precompile compiles Catalyst's CSS with Dart Sass (CSS bundler)
PaperTrailNeeded for roles and record history (paper_trail gem)

1. Add the gem​

Gemfile
source "https://gems.betterplatforms.dev" do
gem "better-platforms-catalyst"
end

Keep the source block: an unrelated gem called catalyst is published on rubygems.org.

bundle install

2. Run the install generator​

rails generate catalyst:install

This installs Action Text and i18n-active_record, mounts the engine at /admin, creates config/initializers/catalyst.rb, app/policies/application_policy.rb and the catalyst/custom.js / custom.css assets, and runs the file import/export migrations. See the Install generator for the full list.

3. Set up authentication​

Catalyst reads the signed-in user from Current.user.

  • No authentication yet? Run rails generate catalyst:add_authentication. It sets up Devise, an Authentication concern and the Current model.
  • OTP login? Use the built-in flow: see Authentication & OTP.
  • Existing auth? Set Current.user in a before_action of your admin controllers.

4. Set up roles and permissions​

rails generate catalyst:install_role
rails generate migration AddCtRoleToUser ct_role:references
rails db:migrate

This creates Catalyst::Role and Catalyst::Permission and an Admin role with every permission. Assign a role to your user (user.update!(ct_role: Catalyst::Role.find_by(name: "Admin"))). See Roles & Permissions.

5. Copy any remaining migrations​

rails catalyst:install_migrations
rails db:migrate

Verify​

Start the server and open http://localhost:3000/admin. After signing in you should see the Catalyst dashboard.

tip

Missing a model in the sidebar? Every model must be listed in config.included_models in config/initializers/catalyst.rb.

Next steps​