Skip to main content
The sync package provides a client-side runtime for building offline-first applications. It combines reactive state primitives (Signals, Computed values, Effects) with synchronized collections that stay in sync with a server.

What is Offline-First?

In a traditional web application, the server is the source of truth. When you’re offline, the app doesn’t work.
In an offline-first application, the client keeps a local copy of the data. Changes are queued locally and synced when connectivity is available.
Benefits:
  • App works without internet
  • Instant UI updates (no loading spinners)
  • Better user experience on slow connections
  • Resilience to network failures

What the Sync Package Provides

Reactive Primitives

These provide fine-grained reactivity similar to SolidJS or Vue’s Composition API.

Synchronized State

The Sync Protocol

The client and server communicate using a simple protocol:
  • Push: Client sends queued mutations to server
  • Pull: Client requests changes since last sync point (cursor)
  • Snapshot: Client requests full state (initial load or resync)

Reactive Primitives

Signal

A Signal holds a value and notifies subscribers when it changes:

Computed

A Computed value derives from other signals and updates automatically:

Effect

An Effect runs a function whenever its dependencies change:

Collections and Entities

Collections manage groups of entities that sync with a server:

Quick Example

Here’s a complete example showing the sync system:

Architecture

When to Use Sync

Use sync when:
  • Building offline-capable applications
  • You need instant UI updates without loading states
  • Multiple clients need to see synchronized data
  • You want fine-grained reactivity in Go
Consider alternatives when:
  • Building server-side only applications
  • You don’t need offline support
  • Simple request/response patterns are sufficient

What’s Next?

  1. Quick Start - Build your first synced app
  2. Client - Client configuration and lifecycle
  3. Reactive - Deep dive into Signal, Computed, Effect
  4. Collections - Working with synchronized data
  5. Integration - Combining sync with live for real-time updates