OUTCOME PLAYBOOK
Add realtime collaboration
Build a live collaborative document with authoritative hydration, early-edit reconciliation, durable jobs, and multi-instance fanout.
- 1. Choose
- 2. Install
- 3. Run
- 4. Verify
- 5. Harden
- 6. Operate
#Choose the package boundaries
Required packages establish the local success path. Production and operate packages close durability and evidence boundaries.
#Prerequisites
One stable authenticated document id and authorization check.
A durable authoritative store for document rows or CRDT bytes.
A cluster bus when more than one server accepts connections.
#Install the complete surface
BASH
bun add @absolutejs/sync @absolutejs/queue @absolutejs/auditSmallest useful file tree
TXT
src/
collections.ts # schema, params, authorization
sync.ts # engine and durable store
server.ts # WebSocket route
client.tsx # ready state and buffered edits
jobs.ts # durable side effects#Run and verify
Scope
Define one document-scoped collection with params and server authorization.
Proof of success: A user without document access cannot subscribe.
- 1. Choose
- 2. Install
- 3. Run
- 4. Verify
- 5. Harden
- 6. Operate
#Expected results
Two browser tabs converge after concurrent edits.
Edits made before authoritative hydration are retained.
A reconnected client receives only the delta it missed.
#Development to production
DevelopmentIn-process subscribers and storesProductionDurable store plus Postgres or Redis cluster bus
Connections and authoritative state are distributed across processes.DevelopmentInline post-update workProductionIdempotent queued jobs
External effects must not extend or duplicate the collaboration transaction.#Failure decisions
The client hydrates the wrong document or an empty collection.
Check firstConfirm document-scoped params and authorization resolve the same collection key.
ThenReject or resubscribe before applying local state.
Updates reach clients on only one server.
Check firstCheck whether more than one application instance owns subscribers.
ThenAdd the Postgres or Redis cluster bus.