Why collaborative backends are hard
Conflict resolution is tricky
Operational transformation algorithms are tricky enough on their own. Coordinating them across separate database reads and writes adds race conditions on top.
Infrastructure sprawl
Message brokers for pub/sub, databases for persistence, caches for performance, and coordination logic across all of them.
Latency at every hop
Users expect changes to appear instantly. Traditional architectures have multiple network hops: client to server, server to database, through pub/sub, to other clients. Each hop adds delay.
Seamless sync
Users expect editing to just work, whether they're online, offline, or on a flaky connection. The backend needs to handle all these scenarios without special cases.
Colocation changes everything
Colocation means your application logic runs where the data lives. Instead of fetching state from a database, transforming it in your application, and writing it back, Rama executes your code directly on the node storing that data.
Conflict resolution at the data
OT logic runs atomically where the document lives. No round-trips, no race conditions between reading current state and writing the transformation.
Flexible state for OT algorithms
OT algorithms need to track edits, versions, and transformation history. PStates let you store these structures however you need, with efficient subindexed access as they grow.
Reactive queries replace pub/sub
Push changes to collaborators as they happen. Sub-millisecond callbacks, no separate messaging infrastructure.
Scales horizontally
Add nodes to handle more documents and collaborators. Built-in replication and automatic failover keep sessions running through node failures.
RUN THE EXAMPLE LOCALLY
next-level-backends-with-rama-java contains CollaborativeDocumentEditorModule, a self-contained example of building a collaborative backend with Rama.
git clone https://github.com/redplanetlabs/next-level-backends-with-rama-java.gitcd next-level-backends-with-rama-javamvn test -Dtest=CollaborativeDocumentEditorModuleTestRAMA IN FIVE MINUTES
See how Rama integrates databases, caches, queues, and processing into a single system where you only write business logic. This post walks through an example showing how a traditional Postgres-based architecture accumulates complexity while Rama keeps everything simple.
Join our Discord
Join the Rama Discord community to ask questions and connect with other developers
Join Discord