How to Use Yjs in Rails With Importmap
Feb 21, 2024Yjs is a CRDT (Conflict-free Replicated Data Types) implementation in JavaScript.
What it means is when you want many users work on the same document, permanently adding, updating, deleting parts of it, CRDT is what you need to synchronize document content between all of the users, automatically resolving conflicts between their editings.
Yjs provides a Ruby port and even an ActionCable-based adapter so users of your Rails application can enjoy collaborative editing using an ActionCable websocket connection.
Unfortunately at the moment of writing this Yjs is not so well suited “out of the box” to be used with importmap, which become a standard since Rails 7. Below is my (kinda hacky) recipe how to make it work.
Read more