> ## Documentation Index
> [HTML page](https://blode.co/stratasync/docs)
> [Documentation index](https://blode.co/stratasync/docs/llms.txt)
> Use the index to discover all available pages before exploring further.

# Open-source Linear sync engine for TypeScript

Strata Sync is an open-source implementation of Linear's sync engine for TypeScript, React and Next.js: instant reads, offline writes and real-time collaboration.

Strata Sync is an open-source implementation of the sync engine behind [Linear](https://linear.app), for TypeScript, React and Next.js. It is a developer library for application data sync, not a strata-management or network-management product.

Reads come from a local IndexedDB replica, so the UI stays fast. Writes queue offline and drain in order when you reconnect. A server-sequenced log means every client converges on the same state.

Linear's engineers described their architecture but never released it. [Linear's sync engine, open-sourced](https://blode.co/stratasync/guides/linear-sync-engine) maps each part of that design onto the module here that implements it, and covers what Strata Sync adds: Yjs CRDT collaboration, undo/redo and swappable adapters. Strata Sync is a clean-room implementation; it contains no Linear code, and Linear is not affiliated with the project.

It runs on your own Postgres and Fastify. There is no hosted service, and every package is MIT licensed.

## Key features

- **Local-first reads**: render from IndexedDB, no network round-trips
- **Server-sequenced consistency**: a monotonic `syncId` orders all changes globally
- **MobX reactivity**: only re-renders components that read changed fields
- **Offline writes**: a persistent outbox replays mutations on reconnect
- **Rich-text collaboration**: Yjs CRDT for multi-user editing
- **Undo/redo**: transaction-based history tracking
- **Field-level conflict resolution**: LWW rebase with configurable strategies
- **Partial replication**: load strategies control eager vs. on-demand sync
- **Type-safe schema**: decorators define models, typed hooks bind them to React

## What you can build

Strata Sync fits products that need local-first responsiveness with predictable sync:

- Collaborative editors with offline draft support
- Task and project apps that must work on unreliable networks
- Customer-facing dashboards backed by a shared canonical state
- Mobile workflows that queue writes and reconcile after reconnecting
- Internal tools that need strong consistency without giving up responsiveness

## How it works

1. Define models with decorators (`@ClientModel`, `@Property`, `@Reference`, `@OneToMany`).
2. Create a sync client with storage, transport, and reactivity adapters.
3. Wrap your React tree with `SyncProvider`.
4. Read data with hooks (`useModel`, `useQuery`) that auto-update.
5. Write data with `create`, `update`, and `delete`: applied optimistically, synced in the background.

## How Strata Sync compares

Every local-first engine makes a different trade. This table describes each
project's documented default architecture rather than scoring them, because
"bring your own" is a design choice, not a missing feature.

|                      | Strata Sync                                | ElectricSQL                             | Zero                            | InstantDB                 | PowerSync                                |
| -------------------- | ------------------------------------------ | --------------------------------------- | ------------------------------- | ------------------------- | ---------------------------------------- |
| Backend              | Your Postgres, inside your Fastify app     | Your Postgres plus the Electric service | Your Postgres plus `zero-cache` | Instant's hosted database | Your database plus the PowerSync Service |
| Extra service to run | None. Redis optional, for fan-out          | Self-host or Electric Cloud             | Self-hosted `zero-cache`        | Hosted by default         | Cloud or self-hosted                     |
| Write path           | Built in: outbox, rebase, idempotency keys | Bring your own write API                | Custom mutators                 | Built in                  | Bring your own upload handler            |
| Ordering             | Server-sequenced log, one global `syncId`  | Postgres logical replication            | Server-authoritative            | Server-authoritative      | Server-authoritative                     |
| Conflicts            | Field-level rebase, three strategies       | Bring your own                          | Server decides                  | Server decides            | Customisable                             |
| Collaborative text   | Yjs CRDT documents and presence            | Bring your own                          | Bring your own                  | Bring your own            | Bring your own                           |
| Undo / redo          | Built in, from transaction history         | Bring your own                          | Bring your own                  | Bring your own            | Bring your own                           |

Pick Strata Sync when you want the whole client and server pair in your own
app, on your own database, and you would rather extend a sync engine than
operate one.

## Packages

Install only the packages you need.

| Package                         | Description                                          |
| ------------------------------- | ---------------------------------------------------- |
| `@stratasync/core`              | Model runtime, schema decorators, transactions       |
| `@stratasync/client`            | Client orchestrator, CRUD, query engine, outbox      |
| `@stratasync/react`             | React hooks and `SyncProvider` binding               |
| `@stratasync/next`              | Next.js App Router SSR bootstrap and serialization   |
| `@stratasync/y-doc`             | Yjs CRDT document and presence management            |
| `@stratasync/mobx`              | MobX reactivity adapter for observable models        |
| `@stratasync/storage-idb`       | IndexedDB storage for data, outbox, and metadata     |
| `@stratasync/transport-graphql` | GraphQL + WebSocket transport for sync and mutations |