System Design Atlas

Collaborative documents with offline edits

06 / 10Worked example

The overall architecture

What are the responsibilities of gateway, merging and local device storage?

This runtime topology follows from the data contract: editor devices with local change store ↔ Synchronization gateway → change and permissions store. Merge Worker creates document views and snapshots. Gateway distributes confirmed changes to authorized devices; Identity Service confirms login. Local pending changes remain marked separately until acceptance. Internal modules are domain code boundaries; on the other hand, an separate process has its own operational lifecycle.

Starting point Check current permissions when the server commits.

Assumptions for the example case

Our own fictitious example design: A text document with a character sequence and comments; several devices per person; deterministic merging; server-side checked permissions during synchronization. Figures and quality goals are illustrative test assumptions. Outside are table formulas, encrypted end-to-end cooperation and automatic content conflict resolution.

Runtime architecture

Runtime Architecture · Local replicas and server-side adoption

Editor devicesLocal change store

Collaboration platform

Synchronization gatewayAcceptance + fan-out
Change and rights repositoriesOperations + Grants + Snapshots
Merge workerDeterministic view
Identity serviceAuthentication
Editor devices → Synchronization gatewaypending operations
Synchronization gateway → Editor devicesConfirmation + Operations
Synchronization gateway → Change and rights repositoriesCommit acceptance
Change and rights repositories → Merge workerAccepted changes
Merge worker → Change and rights repositoriesView + Snapshot
Synchronization gateway → Identity serviceCheck authentication

Devices save offline; the gateway validates acceptance; the worker builds views from accepted changes.

Many connections face few documents. Manage connections and merge separately. Long connections do not block snapshot work.

Domain modules within the application

Synchronization open · five responsibilities

Local draftPending storage
Acceptance of changesIdentity + Right + Bytes
MergingDeterministic text
Rights managementGrants + withdrawal
Snapshot maintenanceCompact up to the revision watermark

Local drafts belong on the device; acceptance, permissions and merging remain separate domain responsibilities.

Local draft: Stores unconfirmed changes on the device.; Change ingestion: Checks Identity, Rights, and Payload.; Merge: Generates deterministic text from accepted changes.; Rights Management: Manages document-specific write permissions.; Snapshot maintenance: Compacts confirmed history with known revision watermark.

Operational boundaries

Runtime
Editor devices with local change store ↔ Synchronization gateway → change and permissions store. Merge Worker creates document views and snapshots. Gateway distributes confirmed changes to authorized devices; Identity Service confirms login. Local pending changes remain marked separately until acceptance.
Persistence
Transactional store for document D-91, devices G-91 and G-92, changes O-91 and O-92. Leading changes and their repetition result are stored together; external side effects require their own proof.

Separate the gateway and merge processing

Separate the gateway and merge processing

Operate connection management and merging separately.

Many connections face few documents.

Long connections do not block snapshot work.

Alternative considered
A process for everything couples restarts to all editors.
Trade-off
Two runtime parts need observation.
Reassess
Small teams allow easier operation.

Terms in this step

Separate the gateway and merge processing
Long connections do not block snapshot work.

Try it yourself

Assign open connections, merging and local drafts to their runtime boundaries.

A hint for your attempt

Use the specific entities and conditions from this step. The two solution parts distinguish the decision from its evidenced outcome.

Compare with a possible solution
First part of the solution
Synchronization gateway manages connections; merge workers generate confirmed views and snapshots.
Second part of the solution
Local drafts are on editor devices until acceptance. The gateway may not output them as confirmed shared content.

Apply to your project

Which corresponding assumption in your project would you check first? Use as an occasion: Small teams allow easier operation.

Step 7 Examined: Survive Response Loss.