PhaseLock
Live apps that still work offline
PhaseLock is an open-source backend with a sync engine for web, iOS, and Android.
Instant navigation.
Live collaboration.
Works offline.
Apps built on PhaseLock get all three on day one.
You define your types and write your business logic once. Then you write any number of frontends in any framework, each one a different skin in front of the same business logic. PhaseLockDB and PhaseLock's sync engine do the rest:
- Live replication from server to client.
- Live queries against the client store.
- Optimistic updates for in-flight mutations.
- Offline mode with flexible conflict resolution.
PhaseLock for…
Developers
Fall in love with building apps that people fall in love with.
Agencies
Build apps for your clients at a fraction of the cost.
We're building a cloud!
Deploy a PhaseLock app with a single command.
Free tier is included.
Coming December 2026.
Our mission
I founded PhaseLock to reverse the enshittification of software.
Many apps should have instant navigation, live collaboration, and offline mode... but don't. Those features are too hard and expensive to build.
PhaseLock makes them easy, so app developers can focus on building great user experiences.
Let's make software that people love to use.
Ryan Beethe
Founder
Get notified about new features and blog posts.
FAQ
Using PhaseLock
Can I use PhaseLock right now?
PhaseLock is ready for anybody willing to play with alpha software.
While it is still lacking serious documentation, it does have an agent skill to help you get started.
Does PhaseLock work well with coding agents?
PhaseLock is designed to work well with coding agents. Try our agent skill:
(for any agent, as a skill:)
npx skills add phaselock-io/phaselock
(for Claude, as a plugin:)
/plugin marketplace add phaselock-io/phaselock
/plugin install phaselock@phaselock
Generally, PhaseLock's system includes strong types at every layer of agent-written code, which converts the most common errors your agent could write into compile-time errors.
Additionally, we have found that coding agents struggle with the complex distributed systems problems that arise with offline and live apps. But your agent can let PhaseLock do those hard parts, leaving your agent responsible for expressing your domain-specific business logic in plain functions, which coding agents excel at. The final result is a more reliable application with more features than your coding agent would produce from scratch.
Is PhaseLock open-source?
PhaseLock is open-source and licensed under the Apache License 2.0. Check us out on GitHub.
When will PhaseLock Cloud be ready?
We are aiming for the free tier of PhaseLock Cloud sometime in December 2026, with the paid tier to follow.
Does PhaseLock lock me in to a single cloud or backend?
PhaseLockDB is purpose-built to offer the best possible sync features, and PhaseLock's sync engine only works with PhaseLockDB.
PhaseLock Cloud, when it becomes available, will host PhaseLockDB. We hope to make PhaseLock Cloud the easiest and simplest way to deploy a PhaseLock app. But PhaseLockDB is licensed under the Apache License 2.0 and is fully self-hostable.
What frontend frameworks does PhaseLock support?
PhaseLock is designed to deliver fresh, reactive state to any UI written in any language or framework.
PhaseLock is written in a combination of Rust and TypeScript, and it is designed to be embedded in other languages. Code generation is used to achieve cross-language strong typing.
Today PhaseLock works on web, iOS, and Android. New languages and frameworks are relatively cheap to add. You can have your coding agent analyze our integrations and write a new one for your language today, or request official support for a new UI framework.
How it works
How is PhaseLock different from a normal CRUD app?
In a normal CRUD app, a client requests mutations with HTTP POST requests (and PUTs, DELETEs, etc). The logic for processing those mutations lives in the HTTP request handlers, only in the server.
After the database is updated, other clients viewing the same data are now viewing stale data. They have no way of knowing it's stale, and no way to update their state other than to redo all the same GETs over and over, waiting for a change to happen.
In contrast, PhaseLock mutation handlers are designed to run in both the client and the server. On the client, the result is an optimistic update, which lands without a network roundtrip or connectivity. On the server (PhaseLockDB), the result is saved to the key-value store and the change is saved to the edit log, which streams automatically to clients so every client is updated quickly and efficiently.
Is PhaseLock only for frontends?
Not only is PhaseLock great for frontends, it is an excellent tool for backend workers.
Backend workers need up-to-date local state and event-driven wakeups to deliver fast side effects and decisions just as frontends need it to deliver fast UI updates. The same database and sync engine serve both needs.
In fact, PhaseLock Cloud will be a PhaseLock app.
Does PhaseLock support fully offline mobile apps and PWAs?
PhaseLock supports fully offline applications, both mobile apps and PWAs. While offline, user actions are saved in an outbox. When you reconnect, the outbox is sent to the server and new edits are downloaded, bringing both sides in sync.
Optimistic updates are simple and typically require no new or duplicated business logic. You provide a "predictor" function that predicts which edits the server's "decider" function will make. Usually the logic can be refactored such that the decider function ends up doing auth checks and simply calling the predictor function directly, so the business logic is only written once.
PhaseLock handles the rest: automatically calling the predictor function when saving mutations to the outbox, applying predicted updates to a state overlay to update the UI, and discarding the overlay when the real edits from the decider come back from the server.
We describe this in detail in our blog post, Optimistic updates should be free.
Does PhaseLock support history compaction?
Yes, history compaction is nearly free with PhaseLock's architecture. PhaseLockDB holds both the current state and an edit log, and the edit log can be configured with a retention policy. If a reconnecting client hasn't synced since before the retention horizon, it will catch up with a recent snapshot instead. PhaseLockDB will ensure a sufficiently recent snapshot exists before pruning the edit log, so no client gets left behind.
Note that the current v0 implementation of PhaseLockDB has only one very limited retention policy implemented: slices can be deleted in their entirety. More flexible retention policies are coming soon.
Do I have to sync my entire database to every client?
The data in PhaseLockDB is organized into slices, and each client will sync only the slices it is allowed to see.
You may not want to send very large or sensitive data at all. For those situations, PhaseLock is designed to support server-side queries, so a client can request named queries with parameters from the server, and the server can execute the query and stream the results.
However, the current v0 implementation of the database does not support server-side queries yet.
How does PhaseLock handle permissions?
For authorizing reads, PhaseLockDB calls a user-provided grantor function that limits which slices of data a user can read. The grantor is allowed to read any state in the database to make its decision. This is detailed in our blog, Syncing as permissions change.
For authorizing writes, PhaseLockDB lets the user-provided decider function decide which incoming mutations are authorized. The decider function also has access to the full state, and it is detailed in our blog Introducing PhaseLockDB, part I.
Won't the first page load take a long time?
When a webpage first loads, or a mobile app is first booted, it has no initial local state and may have to download a substantial amount of data before it starts working. Your users may not appreciate a long loading screen.
In these situations, PhaseLock does not require the cold client to replay the entire edit log to load current state. Instead, PhaseLockDB provides recent snapshots of relevant slices of state so that the client can quickly catch up by snapshot.
How does PhaseLock resolve conflicts?
PhaseLock gives you tools for handling conflicts in various ways, but does not prescribe how you do it. That freedom allows you to handle each conflict case according to the specific needs of your domain.
Many conflicts are well-served by a last-write-wins solution. In this case, you can mostly ignore conflicts in your decider function and just apply each mutation in turn.
In many collaborative cases, CRDT-based solutions work well. Matthew Weidner's position-strings and list-positions libraries fit particularly well into PhaseLock's architecture.
In more complex cases, and frequently with offline-capable apps, it is important to capture the human effort associated with every mutation, even conflicting ones. In those cases, your decider can simply save every mutation into state, and your UI can surface conflicts for the user to resolve.
In other cases, like account sign-ups, the feature is expected to only
work online and the server can simply refuse a mutation that would
create a conflict. In Postgres, this would be done in a transaction.
In PhaseLockDB, the checks happen in a decider function (which also
runs in a transaction). There is also an @online
decorator in PhaseLock's TypeSpec system for these sorts of mutations,
as PhaseLock's sync engine handles them specially (basically by
refusing them unless there is an active connection, rather than
queueing them in an outbox).
Does PhaseLock use CRDTs?
PhaseLock itself does not use CRDTs, but PhaseLock can help you use CRDTs whenever they make sense for you.
Depending on your app needs, it may make sense for your mutations to represent CRDT updates and for your decider to capture those directly into PhaseLockDB. Then in the client, you can use Yjs or another pure JavaScript CRDT library to handle them. Matthew Weidner's position-strings and list-positions libraries fit particularly well into PhaseLock's architecture.
Compared to…
How does PhaseLock compare to Firebase?
Firebase is a comprehensive platform. Its database, Firestore, offers offline mode and optimistic updates, much as PhaseLock does.
However, Firestore handwaves a lot of details that PhaseLock takes seriously:
- Firestore has security rules, but they are hard to write and hard to test, plus every query has to restate them. PhaseLock has a grantor function for read permissions and a decider function for write permissions, and they are plain functions that are trivially unit-testable.
- Firestore documents are schemaless. In PhaseLock, your data model is declared in TypeSpec and all user code is strongly typed throughout the whole system, even across languages.
- Firestore has transactions, but they don't work for offline writes. It has batch writes, which are atomic but can't support read-modify-write behaviors. PhaseLock has mutations which are processed atomically in order of arrival, with global read access when determining outcomes, and it works the same regardless of how long a client was offline.
-
Firestore aggregations like
count(),sum(), andaverage()don't support real-time updates or offline caching. Their solution is write-time aggregation, but that either means using transactions, which don't work for offline writes, or Cloud Functions, which run asynchronously and sometimes multiple times. PhaseLock's write-time aggregations are handled exactly once in the same database commit and naturally support real-time updates and offline caching.
Additionally, Firestore only runs on Google's cloud, while PhaseLockDB is licensed under the Apache License 2.0 and you can self-host on modest hardware.
How does PhaseLock compare to PowerSync?
PowerSync is a sync layer that sits between your backend's database and a SQLite database in your frontend. PhaseLockDB is a sync-focused all-in-one backend, modeled as a key-value store plus an edit log. Both projects deliver live updates and reactive queries of your data. PhaseLock delivers sync features with a single backend service rather than three (your database, your backend, and PowerSync itself).
Also, PhaseLock uploads mutations while PowerSync uploads row updates.
The distinction is important for conflicts; PowerSync documents seven
custom conflict resolution strategies that amount to your backend
trying to reverse-engineer client intent like "increment a quantity"
from a row change that only communicates the new number. In PhaseLock,
conflicts can still arise between mutations, but entire classes of
conflicts are avoided because mutations like
IncrementQuantity naturally apply in any order. True
conflicts of intent are both rarer and more easily solved in PhaseLock,
because your decider that resolves the conflict inside PhaseLockDB has
race-free read access to global state.
How does PhaseLock compare to Convex?
Convex is a realtime database designed to serve the needs of both reactive UIs and backend workers, much like PhaseLock.
Convex also supports end-to-end type safety, like PhaseLock.
Convex is limited to server-side queries, while PhaseLock supports primarily client-side queries, with server-side queries on the roadmap. This means PhaseLock supports offline-capable apps while Convex does not (though Convex is working on Curvilinear, their own offline sync engine).
PhaseLock's sync system delivers optimistic updates for zero-latency UI updates by reusing your existing business logic. Convex requires manual work per operation, per query affected by each operation to deliver optimistic updates.
How does PhaseLock compare to Zero?
Zero is a sync engine focused on high-performance, low-latency access to huge backend stores. Zero's architecture is roughly a server-side queries pattern, plus a smart local cache for returning initial results without a round-trip to the server.
However, for offline apps, Zero supports reads but only from what happens to be cached, and Zero doesn't have a built-in "sync everything" mode. Offline writes are supported, but only for short-duration network disruptions. It is not designed for long periods offline. PhaseLock has full support for offline reads and writes with optimistic updates.
Zero is designed more like an instant-startup app accelerator for apps that are mostly always online. PhaseLock is designed for fully offline-capable applications that maintain a complete, persistent local store.
Additionally, Zero only supports JavaScript environments, so web and React Native. PhaseLock is written in Rust and TypeScript and specifically designed to be embedded in other languages.
How does PhaseLock compare to Electric + TanStack DB?
Electric is a read-side sync engine over Postgres, and TanStack is its natural client-side counterpart. They can be added to existing Postgres-based applications easily, while PhaseLock is meant to be used from the beginning of an app's development.
Electric supports queries written in SQL, while PhaseLock supports a key-value storage model with queries written as plain functions.
Additionally, while Electric works in non-JavaScript environments, TanStack doesn't, so offline apps are limited to web or React Native. PhaseLock is written in Rust and TypeScript and specifically designed to be embedded in other languages.