Skip to content

How to customize Trek

Trek is designed to get you started fast with useful conventions, then get out of the way: most of the generated code lives in your application, so customizing it is just regular Rails work. Here are the most common entry points.

Admin panel branding

You can pick the title and subtitle used in the admin panel header.

yml
# config/locales/en.yml
en:
  admin:
    brand:
      title: My Awesome Project
      subtitle: Back-office

Replace Trek's favicon with your own:

  • in SVG format at app/assets/images/favicon.svg
  • in PNG format (512 × 512 px) at public/favicon.png

Components

Trek's UI components accept options where it matters:

  • Trek::Form::ActionsComponent — pick an aspect and add your own classnames to restyle form action bars.
  • Trek::DialogComponent — set the title and the buttons of modal dialogs.
  • Trek::Form::ContentEditorComponent — toggle the nodes, blocks and floating options to slim down the editor where full rich text isn't needed:
ruby
f.content_editor :intro, nodes: false, floating: false
  • Trek::LayoutComponent — use the panel slot to add your own side panel to admin screens.

Models

The models generated by the installer and the scaffold are plain Active Record models in your app/models. Enable the commented-out hooks to opt into Trek features, for instance:

ruby
class Book < ApplicationRecord
  include Trek::Formattable
  format_attributes Trek::TypographyFormatter, :title

  include Trek::Translatable
  translate_attributes :title

  include RecordImageUploader::Attachment(:image)
end

See the concerns reference for the full list.

Policies

Each scaffolded resource gets its own policy in app/policies/admin. Adjust the rules and permitted_attributes per role — the policies reference shows the generated default.

Theming

Trek's admin supports light, dark and auto themes, selectable per user. The design tokens are based on Radix colors; override the CSS custom properties in your own stylesheet to adapt the palette.

Dependencies configuration

The installer configures Shrine, Postmark, Sorcery, ActionPolicy, Mobility and friends with sensible defaults — through initializers generated in your app. You can edit them at any time:

  • config/initializers/shrine.rb — storage backends, upload limits
  • config/credentials.yml.enc — Postmark API token (EDITOR="code --wait" bin/rails credentials:edit)
  • config/i18n-tasks.yml — locale management rules

Released under the MIT License.