How Strata Sync works, from one line of code

You set a field and call save(). Strata Sync writes it to a copy on the device, so the screen updates at once, then sends it to a server that numbers every change and passes it to every other device. Offline, catching up and undo all fall out of that one path.

task.title = "Hello";
await task.save();

That is the whole API for changing something. You set a field and call save(). Everything else on this page is what happens next, and none of it needs a second line of code from you. Every figure runs on its own, so you can just read, or press things.

The screen updates first

save() does not send anything yet. It writes the new title into a copy of your data that lives on the device, and the screen reads from that copy. So the title changes before the network is involved at all, and any component showing that task redraws on its own. Then, in the background, the change sets off for the server.

Your phone
Draft, not done
Server
Draft, not done
Network delay
1200 ms

Both copies say “Draft”.

Drag the delay as high as it goes. The phone changes just as fast.

The row only ever waits for one thing: to turn from amber to green. That is the server saying it has the change too. Until then, the change is real on your phone and nowhere else.

Offline changes nothing

If there is no network, the change sits in a queue on the device and waits. The queue is stored on disk next to your data, so it survives closing the app. When the network comes back, the queue sends each change in the order you made it.

Your phone
Draft, not done

Waiting to send

Nothing waiting.

Server
Draft, not done

Online, with nothing waiting.

Go offline, make two changes, then come back.

Your code does not change for any of this. You call save() the same way whether you are online or not, and the queue takes care of the rest.

The server keeps one list

Every change from every device goes into one list on the server, and each one gets the next number. The server then sends each new entry to every other device, which applies it to its own copy. Two devices that have seen the same entries hold the same data, with no merging to do.

Your phone
Draft, not done
Server
Draft, not done

Every change, in order

Nothing yet.

Another phone
Draft, not done

Two phones and one server, and they all agree.

Every change goes through the server, which numbers it and passes it on.

Each device remembers the last number it has seen, so catching up is one question: what came after that? A brand-new device has no number yet. It asks for everything once, and from then on only asks for what it missed.

Coming back after a while

Say your phone was offline for an hour with a change waiting to send, and in the meantime someone else changed the same task. When your phone reconnects, it first applies what it missed, then puts your own change back on top. If the two of you changed different fields, both changes stand. If you both changed the same field, theirs was already on the server, so yours is dropped rather than overwriting something you never saw.

Your phone
Draft, not done

Waiting to send

Nothing waiting.

Server
Draft, not done

Every change, in order

Nothing yet.

The other phone changed

Your phone and the server agree.

Switch what the other phone changed while you were away.

That decision is made field by field, which is why two people can work on the same task all day without treading on each other.

Undo comes for free

Every save records what the field was before. So undo is nothing special: it saves the old value back, as an ordinary change. It gets a number and reaches every other device like any other, which means an undo on your laptop shows up on your phone.

Your phone
Hello, not done

Remembers

title was "Draft"

Server
Hello, not done

Every change, in order

  1. #1title"Hello"

The title is “Hello”, and the phone remembers it was “Draft”.

Press Undo, then Redo. Each one is just another numbered change.

The one thing a list cannot order

Numbering settles a title. It does not settle a paragraph two people are typing into at the same time: put those two edits in a list and the second one replaces the first, words and all. For text like that, Strata Sync keeps a Yjs document beside the row, where an edit says where the characters go rather than what the whole field is now. Two of those combine on their own.

Your phone

Ship the notes

Another phone

Ship the notes

If the list picked one

Ship the release notes today

Merged with Yjs

Ship the release notes today

One sentence, on two phones.

Two people type into the same sentence at the same time.

All of it, from one line

  • The screen updates at once, because the data is on the device.
  • Offline changes wait in a queue on disk and send in order.
  • The server numbers every change, so every device ends up the same.
  • Coming back means applying what you missed and putting your change on top, field by field.
  • Undo saves the old value back, and syncs like anything else.
  • Long text merges through Yjs instead of the list.

Two things this page left for the docs. A sync group decides which rows a device is allowed to have, so your phone syncs your workspace and not the whole company; the protocol page covers it. A load strategy decides which of those rows arrive at sign-in and which wait until something asks for them. The rebase settings and collaborative editing are there too.

Get started

One command. It scaffolds a working app with the sync server wired up.

npx stratasync init my-app
Read the docs