Skip to content

Reference

Packages and hosts

Install the integrations your app needs. Each package’s manifest lists its compatible Effect and framework peer dependencies.

Both integrations use the same DurableObject.make definition. Choose the framework that already owns your Worker and pass its provider to .provide(...):

bun add @yielded/sync-platform-cloudflare \
@yielded/sync-platform-effect-cf effect-cf

Or, for Alchemy:

bun add @yielded/sync-platform-cloudflare \
@yielded/sync-platform-alchemy-cf @alchemy.run/cloudflare alchemy
Framework Provider Example
effect-cf EffectCfServices Counter Worker
Alchemy AlchemyServices Alchemy setup

Each adapter supplies SQLite, crypto, transport, and lifecycle hooks; your app supplies authentication. To use another store, pass a SourceStorage Layer as storage to DurableObject.make. Keep object identities and storage namespaces stable if you want to retain the existing data. A new namespace starts a separate store; reconcile pending commands and delivery work before switching.

Use Server.host with your own SourceStorage and ServerCrypto Layers. Keep one host per storage authority and keep its scope alive for its connections. ServerRpc.handlers connects the host to an Effect RPC transport; provide ServerRpc.CurrentConnection from authenticated server context.

See the host API for limits and outbox scheduling, and the RPC API for transport composition.

bun add @yielded/sync-platform-browser \
@yielded/sync-local-indexeddb @effect/atom-react react

BrowserSource.bind supplies browser services and Atom bindings. To keep pending edits across reloads, add an IndexedDb Layer. Otherwise, choose "volatile". See client setup.

For custom persistence, implement ReplicaPersistence directly or use Persistence.make for shared record handling over your storage drivers.

Entry point Main APIs
@yielded/sync Source, Action, Plugin, schemas and errors
@yielded/sync/server Server, ServerRpc, SourceStorage, ServerCrypto
@yielded/sync/client Client, ReplicaPersistence
@yielded/sync/atom SourceAtom for custom Atom runtimes
@yielded/sync-platform-browser BrowserSource
@yielded/sync-local-indexeddb IndexedDb
@yielded/sync-persistence Persistence and storage driver contracts

Public modules also support direct imports:

import * as Source from "@yielded/sync/Source";
import * as Client from "@yielded/sync/client/Client";