Offline mode is free. For the backend.
PhaseLock is an open-source backend for live apps that still work offline. You declare your types and write your business logic once, then PhaseLock's sync engine powers your web app, your mobile app, and even your backend workers.
A seasoned developer looks at me, concerned.
"Isn't offline mode hard to write? Aren't there a bunch of weird corner cases to worry about?"
He's right to ask. But fortunately, the "weird" corner cases don't exist, only the normal ones.
To write a robust POST request handler, you already need a bunch of checks:
- Is this requester authorized to make this request?
- Does the target object even exist?
- Is it in a state where this request makes sense?
These are basic consistency checks, you've been writing them for years, and none of them care about how long the client has been offline. Arguably, the server doesn't even know what "offline" is because it can only talk to clients that are online.
That means: if you can build a REST API server, you can already build an offline backend.
The frontend's where the party's at
The truth is that offline apps do bring new challenges, but they all come from the frontend.
A lazy app goes offline and says, "sorry I can't do anything, you don't have internet right now." The user is disappointed, but at least they're not confused.
A good app keeps working offline and now faces a wave of new scenarios:
- The information you have for the user may already be stale, but you can't know until you reconnect.
- Some offline actions taken by the user should appear in the UI now, but may get rejected by the server later, long after the user has moved on.
- Other offline actions may be virtually guaranteed to land (like a user updating their own preferences), so no single UX applies to all offline actions.
Each of these new scenarios needs to be surfaced to the user in a way that's understandable and actionable. Some states in the UI need to be shown as "unconfirmed" until the app reconnects. Some kinds of user edits are so valuable that even if there's a conflict, you need to capture them and surface them for recovery, like how git handles merge conflicts.
What's exciting is that these challenges are also what unlock new possibilities for users.
Really good offline mode brings health technology to remote villages. It lets field technicians focus on troubleshooting equipment rather than working around flaky applications. And it might just be the killer feature that separates your app from your competitors.
Our machinery, your magic
Let PhaseLock provide all the offline machinery: incremental sync, optimistic updates, and connection management.
Focus your creative efforts on what brings real value to your users: a great user experience around features that Just Work, all the time, rain or shine.
Embrace the UX challenges around offline mode, because each scenario that apps aren't used to facing unlocks features that users aren't used to having.