Skip to content

Comparison ​

How Twinstate relates to other sync engines and data tools, and when another one is the better choice. Comparisons are as of 2026-10 and say what each tool is built for, not which is better.

Where the server is the application ​

Twinstate is for apps in which the server is the application: it runs the logic (agents, jobs, streaming replies, workflows), and the data lives in whatever storage suits it. Engines that replicate a database are for apps in which the database is the application: Postgres holds the truth, many services write to it, and clients query it.

the server is the applicationthe database is the application
examplesassistants and agents, job-heavy tools, per-user or per-workspace appsPostgres-centred CRUD with many writers
fitsTwinstateZero, ElectricSQL, PowerSync

Two families of sync engine ​

A: the database orders writesB: a server per unit orders writes
howwrites go through your API into the database; a sync service reads the database's change log and streams it to clientsa stateful server holds the state, runs the logic and orders every write; many units run side by side
needsa database with a durable, ordered, resumable change log (Postgres logical replication, MongoDB change streams, MySQL's binlog), one source per sync servicenothing: the server's own queue is the log, so storage may be anything, mixed per kind
scales byadding sync nodes for reads; writes scale with the databasepartitions across machines; one unit's writes go through one queue
whoElectricSQL, Zero, PowerSync, Supabase RealtimeTwinstate, Durable Objects, PartyKit, Liveblocks, tldraw sync, Figma's per-file servers

A database hook that is not a durable log (SQLite's update_hook, which sees only its own connection's writes and is lost on a crash) cannot feed family A. Several databases can be streamed together (Debezium into Kafka), but nothing then orders a write in one against a write in another.

Twinstate, Zero and PowerSync ​

TwinstateZero / PowerSync
server logicfirst-class: turns, jobs as state, appendable text streamed from memorycustom mutators or your API; streamed text is a database write per token
storageany, through one adapter per kindone source database (Postgres first)
infrastructurea library in your processa sync service beside your database
accesspolicies on every field and record, projected per viewer (sessions and access)server-defined queries and mutators (Zero), sync rules (PowerSync)
offline writesa durable outbox: idempotent, held after 24 hours, never drops typed textPowerSync: an upload queue; Zero: writes need a connection
enforced by typesalmost every mistake does not compiletyped APIs, fewer enforced rules
apps with many writers to Postgresbridges: the change log into mutateno glue: every write reaches clients
queries on the clientdeclared shapes and windowsrelational queries over synced data (Zero, as named queries), SQLite on the device (PowerSync)
large datasets on the devicethe cache is a starting pointbuilt for it
native mobileweb and ReactPowerSync: Flutter, Kotlin, Swift
maturityearlyin production, hosted options

Neighbours in family B ​

what it isa unitdataoffline writeshosting
Durable Objectsa primitive: a single-threaded actor with storagean objectyours to buildyours to buildCloudflare
PartyKitrooms on Durable Objectsa roomyours (often Yjs)yours to buildCloudflare
Liveblockshosted rooms: storage, presence, commentsa room (one document)CRDT structuresa CRDT merges latermanaged
tldraw syncsync for tldraw documentsa documenttldraw's recordsheld while disconnectedself-hosted (a Durable Objects template)
Yjs servers (Y-Sweet, Hocuspocus)servers for Yjs documentsa documentCRDTsa CRDT mergesself-hosted or managed
Twinstatea framework in your servera server (a partition) holding many kinds, loaded lazilytyped records, last write wins per fielda durable outboxanywhere Node runs

Twinstate is what one would otherwise build inside a Durable Object, and it holds an app's whole model per unit, not one document. Where it is weaker: two people typing in the same paragraph (a CRDT's job: pair Twinstate with a Yjs server for those fields, or a merging field encoding later), presence and cursors (not built in), and hosting (none managed).

Running on many servers ​

All of these run on many servers; what differs is what can be spread out. Durable Objects, Liveblocks and Twinstate spread units (objects, rooms, partitions), each on one server at a time, so one very busy unit is bounded by one machine. Only CRDT servers keep one document on several servers, each taking writes and ordering them itself, because their copies merge in any order. Engines built on a database take writes on many servers too, but the database orders them, so the database's primary is the one place each document's writes meet. What orders the writes decides what running on many machines takes:

what orders writesroutingone owner per unita deploy, for clientswhat you run
Twinstatea queue per partitionhashed by partition at the load balancera lock per partition, fencing in the storereset (a new epoch), from the storeNode pods, a lock store, your data store (scalability)
Durable Objects, PartyKitthe objectthe platformthe platformthe platform restarts objects from their storagenothing: Cloudflare runs it
Liveblocksits servers, per roommanagedmanagedmanagednothing: a service
Yjs serversnobody: CRDTs mergesticky helps, not requirednot needed: copies merge (via Redis)reconnect and mergeinstances, and Redis for several
ZeroPostgresa load balancera single replication manager; view-syncers interchangeablea client's record, kept in Postgres, lets a syncer resume itPostgres and zero-cache
ElectricSQLPostgres, through your APIplain HTTP, cacheablenot needed for readsresumes by its offsetPostgres and Electric
PowerSyncyour database, through your APIa load balancerthe databaseresumes by checkpointyour database and the PowerSync service
Orleans, Akka Shardingthe actorthe framework's directorythe framework (leases, a coordinator)actors reactivate elsewherea cluster of their runtime

Any engine with one writer per unit needs routing by unit and one owner at a time, from a platform (Durable Objects, Liveblocks), a framework (Orleans, Akka), or your infrastructure (Twinstate keeps only close and the server's outbox interface). The ones that need neither give up single-writer ordering: to a database (Zero, ElectricSQL, PowerSync) or to CRDTs.

Twinstate or Durable Objects ​

They sit at different layers. Durable Objects are a platform primitive (hosting, a single-threaded actor, storage, routing); Twinstate is a sync framework (the data model, the client replica, optimistic effects, the outbox, lazy loading, policies, React, generated tests), and could run on Durable Objects, a partition per object (on the roadmap). Building that sync layer on Durable Objects yourself is most of what Twinstate is; Cloudflare's Agents SDK covers a thin slice of it (state on an agent, synced with a hook).

choosewhen
Durable Objects alonea small realtime feature (a counter, a room, presence) on Cloudflare, with sync logic you are glad to write
Twinstate on Nodean app's state on many devices, with server work that needs a full runtime (subprocesses, long connections, any npm package), your own data and infrastructure, no platform lock-in
Twinstate on Durable Objects (later)both: the framework's guarantees and no servers to run, for apps that fit within Workers' limits

TanStack ​

TanStack's libraries are headless building blocks; Twinstate is an opinionated framework, strict where strictness buys a guarantee.

TanStack QueryTanStack DBTwinstate
coversthe client cachethe client store and live queriesserver engine, protocol, client and React
data fromyour API (pull)any collection you plug in (Query, Electric, PowerSync, RxDB)its own server (push)
ordering and confirmationnonethe backend'sone queue; replies after data
client queriesper requestlive joins and filtersdeclared shapes and windows

They combine rather than compete:

  • TanStack Query keeps one-off REST calls; Twinstate holds live, shared state. Both live in one app.
  • TanStack Router (and React Router): client.preload(Entry, props) in a route loader starts a screen's data with its code.
  • TanStack DB could take Twinstate as a collection, giving live client queries over the replica (on the roadmap).

What is strict, and why ​

Strict at the core, composable at the edges. The core is strict because each rule buys a guarantee: one queue (ordering, no conflicts), a durable outbox (no lost work), policies on every field (nothing visible by accident), compile-time rules (mistakes caught before they ship). The edges stay open, so Twinstate can be adopted next to what an app already has: Query beside it, any router, bridges into an existing backend (server.mutate(…, { key }), designed), and a framework-free client API that other bindings can build on.

Three examples ​

appTwinstate's rolepartitionsthe truth
a personal assistantthe backendone per userits files or database, through adapters
bankingthe live view of a ledgerone per usera ledger database; transfers are intents, results bridged back into both users' partitions
a social networkthe realtime layer over a sharded backenda home per user; one per thread or communitysharded stores, a timeline store fed by fan-out, search and counters elsewhere

The database layouts and data flows for each are in scalability.

Sources ​