PRO

Effect CRDT Counter Merge

A conflict-free counter that never loses an increment under partition. Representing a distributed count as one mutable cell means two servers reading 10 and writing 11 turn two likes into one; last-write-wins silently drops increments under any race. A state-based grow-only counter gives each replica its own slot that it only increments, the value is the sum of slots, and merge is element-wise max, commutative, associative, and idempotent, so replicas that exchanged updates in any order and any number of times always converge with no coordinator. The demo shows LWW losing a like, then 3+5+2 taken under partition converging to 10 on every replica with re-delivered stale merges harmless. Pinned to effect 4.0.0-beta.98.

Install
npx shadcn@latest add https://ui.aryank.space/r/effect-crdt-counter-merge.json

Installs from ui.aryank.space. To add it by hand, copy the files in Files below, or register the @compronents namespace via the docs.

Visualization
counter
increment
number
likes
10
read 10 -> write 11 (x2) // one like lost

Two servers both read 10 and write 11. Last-write-wins on one mutable number turns two likes into one: an increment vanishes under any race or partition.

Files

Dependencies