Before implementing real-time synchronization in Suga, developers encountered issues with simultaneous project modifications leading to overwritten changes. To address this, they integrated Zero as a real-time sync engine. This involved:
- Granular Mutators: Handling individual changes like adding compute resources or adjusting node positions through granular mutators that spread and merge data.
- Bulk Mutators: Managing operations such as undo/redo by replacing entire snapshots without merging.
- Drizzle ORM Integration: Utilizing Drizzle's schema definitions to serve as the source of truth for Zero’s sync schema, simplifying state management.
- Nanostores for Local State: Employing Nanostores for client-specific states like user undo history while relying on Zero for synced data mutations and synchronization.
Challenges included handling JSONB replication units without row-level diffs, ensuring proper schema regeneration after migrations, and configuring publications correctly to avoid silent data loss.
Deployment issues were encountered due to silent 401 errors caused by deployment protection blocking requests between the Zero cache server and main application endpoints. Additionally, cookie-based authentication was problematic for preview deployments with temporary URLs.
By addressing these challenges, real-time collaboration features are now live in Suga, allowing multiple users to
Read the full article at The New Stack
Want to create content about this topic? Use Nemati AI tools to generate articles, social posts, and more.

![[AINews] The Unreasonable Effectiveness of Closing the Loop](/_next/image?url=https%3A%2F%2Fmedia.nemati.ai%2Fmedia%2Fblog%2Fimages%2Farticles%2F600e22851bc7453b.webp&w=3840&q=75)



