DOCS LLMs

User-to-user chats

If your product needs messaging — DMs, group chats, marketplace conversations — don't build it: RailsFast pairs with our chats gem (opt-in), which gives you Instagram-class user-to-user messaging: direct messages, group chats, image attachments, emoji reactions, read receipts, unread badges, and typing indicators — all real-time, all server-rendered.

It's Hotwire-native, which makes it a perfect fit for RailsFast: messages stream over Turbo Streams + Action Cable (the template's Solid Cable — no Redis), the inbox refreshes itself with Turbo 8 morphing, and it degrades gracefully to plain request/response when WebSockets are down. It also works inside the RailsFast Native shells out of the box, since it's just server-rendered Hotwire. This is the same gem powering chat in CarHey (a production RailsFast Native app).

Turning it on

  1. Add gem "chats" to the Gemfile (there's a commented entry under PROJECT-BASED GEMS) and bundle install.

  2. Run the installer and migrate:

    rails generate chats:install
    rails db:migrate
  3. Make your users conversational:

    # app/models/user.rb
    acts_as_messager
  4. Mount the inbox and you're chatting:

    alice.message!(bob, "hola!")               # DM in one line
    alice.chat_with(bob, carol, title: "Trip") # groups
    alice.unread_chats_count                   # for your nav badge

Conversations can be about records in your domain (acts_as_chat_subject + about: ride) — that's how you get marketplace-style threading: one conversation per pair, per subject.

The chats README is the source of truth for the full API, the ejected views, and the moderation hooks — which pair naturally with the moderate gem's report/block Trust & Safety layer (see Abuse protection).