DEV Community

Germán Alberto Gimenez Silva
Germán Alberto Gimenez Silva

Posted on • Originally published at rubystacknews.com on

🚀 Finally! The Alpha Version of TrixGenius Has Arrived — Supercharge Your Trix Editing Experience with AI! 🧠

April 10, 2025

After many late-night commits, experiments, and way too much mate ☕ — I’m incredibly excited to introduce the alpha release of a gem I’ve been crafting with love:

TrixGenius — A smart extension for Trix + ActionText + Hotwire.


🤖 Want to Add AI to Your Ruby on Rails App?

If you’re looking to bring AI features like spelling correction, natural language processing, or smart assistants into your Rails application, I’d love to help!

🚀


🧠 What is TrixGenius?

Article content

TrixGenius is a Rails engine and generator that adds AI-powered buttons to your Trix Editor using Stimulus and Turbo.

In this alpha version, I’m proud to ship a working button that uses AI (DeepSeek or your favorite API) to automatically correct spelling in Trix inputs — all with a single click.

This is just the beginning. The idea is to enhance the Trix experience with intelligent, modular enhancements that plug into your Rails app easily.


🧩 What’s Included in the Alpha?

✅ AI button: “Correct Spelling” via API

✅ rails g trix_genius:install generator

✅ Fully Stimulus-powered Trix extension

✅ Automatic route injection

✅ Auto setup for JS imports

✅ RSpec Generator tests

✅ Ready-to-hack Stimulus controller for more IA buttons


📦 Get trix-genius

The first alpha release</strong of trix-genius is now available! Enhance your Trix editor with AI-powered features today. 💡

🔗 Gem name: trix-genius

📌 Version: 0.1.0

🔍

# Gemfile
gem "trix-genius", "~> 0.1.0"
Enter fullscreen mode Exit fullscreen mode

🔧 Installation (Rails 7 / JS Bundler or Importmap)

Add to your Gemfile:

gem "trix_genius"
Enter fullscreen mode Exit fullscreen mode

Then install ActionText if you haven’t yet:

bin/rails action_text:install
Enter fullscreen mode Exit fullscreen mode

Create a scaffold (optional):

bin/rails g scaffold Post title body:rich_text bin/rails db:migrate
Enter fullscreen mode Exit fullscreen mode

Then run the gem’s generator:

bin/rails g trix_genius:install
Enter fullscreen mode Exit fullscreen mode

This will:

  • Create the initializer
  • Inject needed imports in application.js and controllers/application.js
  • Add the controller (trix_genius_controller.rb)
  • Add JS controller (trix_genius_controller.js)
  • Inject the route:
post "/trix_genius/correct_spelling", to: "trix_genius#correct_spelling"
Enter fullscreen mode Exit fullscreen mode

🧪 Generator Spec Coverage

Yes, this gem ships with RSpec tests for the generator! Here’s an example:

it "adds AI route to correct spelling" do
  run_generator
  assert_file "config/routes.rb" do |content|
    expect(content).to include('post "/trix_genius/correct_spelling"')
  end
end
Enter fullscreen mode Exit fullscreen mode

You’ll find specs covering:

  • Route injection
  • Stimulus controller creation
  • application.js updates
  • Fallback warnings when files don’t exist

🛠 Extensible by Design

Want to add more buttons like:

  • Summarize Text
  • Translate Paragraph
  • Rephrase for Tone

Just extend the controller or hook into the route and Stimulus actions — it’s designed to be hackable.


🔄 Developer Experience Matters

We believe in:

  • Zero config
  • Instant feedback
  • Helpful messaging
  • Undo safety

That’s why our generator not only creates files but gives fallback messages with example content, like this:

def javascript_application_msg
  <<~MSG
     ![⚠](https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/26a0.png) You should create the file manually:

     ![📄](https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/1f4c4.png) app/javascript/application.js

     ![💡](https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/1f4a1.png) With the following content:
    ...
  MSG
end
Enter fullscreen mode Exit fullscreen mode

💬 Why I Built This

Article content

I wanted a way to make rich text editing smarter and more helpful, especially for apps where users are writing a lot. Whether it’s blog platforms, admin panels, or messaging systems — helping users write better and faster just made sense.

And of course… I wanted a smooth install. I hate wiring things up manually. This gem does the setup for you.


👇 Try It Out or Collaborate!

Check out the code, give it a spin, and feel free to open issues or ideas:

🔗 GitHub – TrixGenius 💎 gem ‘trix_genius’

Big shoutout to the amazing OSS ecosystem around Rails, Hotwire, and Stimulus that makes building stuff like this so fun. 🙌


💭 If you’re building AI features into Rails apps or love messing with rich-text UX — let’s connect and share ideas!

rails #rubyonrails #opensource #stimulusjs #hotwire #actiontext #ai #gems #developer #buildinpublic

Article content

Top comments (0)