The Suga team discovered that last-write-wins conflict resolution caused silent data loss when two developers worked on the same canvas simultaneously. They migrated to Zero, a sync engine from Rocicorp that gives each client a local SQLite database synced with PostgreSQL on the server. The post details their mutator design: granular mutators use a read-modify-write spread pattern for node positions and infrastructure changes, while bulk mutators replace entire snapshots for undo/deploy operations. Drizzle ORM serves as the schema source of truth for Zero's sync schema, with two JSONB columns holding collaborative state. Client-only state like undo history is managed with Nanostores. Deployment challenges included silent 401s from deployment protection blocking Zero's internal requests, and cookie-based auth failing on preview environments with dynamic URLs — solved by passing session tokens directly via the ZeroProvider auth prop.
Table of contents
Have you looked at sync engines?Two kinds of changesDrizzle as the schema source of truthNanostores for local stateWorks locally, breaks on deployIt’s live nowSort: