Skip to main content
The sync template combines view rendering, live updates, and data synchronization. The key component is the “sync engine” which tracks changes as operations, replays them to rebuild state, and broadcasts updates to all connected clients. This is how collaborative apps like Google Docs work.

Directory Layout

Core Files

app/server/app.go

service/todo/mutator.go

app/server/routes.go

assets/js/sync.js

Sync Flow

  1. Client Mutation - User action creates mutation
  2. Local Apply - UI updates optimistically
  3. Push to Server - Mutation sent to /_sync/push
  4. Server Apply - Store.Apply processes mutation
  5. Broadcast - Changes sent to all clients
  6. UI Sync - All clients update

Next Steps

Tutorial

Build a syncing todo app

Sync Documentation

Deep dive into sync