VDAOvideo

Offline Sync Is Harder Than It Looks

Kirill Ushakov - Web & Mobile Development · 431 views · 4 weeks ago
Description

GitHub: https://github.com/kir-ushakov/public-ba-codebase/ How hard can offline synchronization really be? I'm continuing to build Brain Assistant, my own SaaS application, with the help of AI. One of the fundamental requirements for a proper Progressive Web App is the ability to work offline without losing changes — and keep data consistent across multiple devices once connectivity returns. That sounds straightforward. Until you actually try to build it. In this video, I walk through the synchronization system I built for Brain Assistant. The application follows a local-first approach. Tasks and tags are stored in the browser, so users can create, update, and delete them without waiting for a server response. Every local change is recorded in a persistent queue. When synchronization runs, the application pulls changes from the server, applies them locally, and pushes its own pending changes. Each device has its own client ID and synchronization cursor, allowing a phone and computer to synchronize independently. At least, that's how it's supposed to work. While preparing this video, I discovered a serious flaw in my own implementation. The system uses timestamps to determine which changes each device should receive. Under certain conditions, a task created offline can successfully reach the server but never appear on another device. The data isn't lost on the server. The other device simply never receives the update. And that's a much bigger problem than it might initially seem — especially when I eventually introduce collaborative task management, where people can assign tasks to each other. We cover: Building a local-first Progressive Web App Storing tasks and tags in browser localStorage Tracking local changes with a persistent synchronization queue Synchronizing automatically and after local changes Understanding the Pull → Apply → Push synchronization cycle Using separate client IDs for different devices Tracking changes with server-side synchronization cursors How offline changes are supposed to converge across devices Why timestamp-based synchronization can silently miss updates The limitations of AI-assisted development without real-world testing The interesting part is that I originally planned this video as a demonstration of a working, carefully designed synchronization system. Instead, making the video helped me discover that the architecture had a serious flaw. AI helped me build the system, but it didn't eliminate the need to question my assumptions, test unusual scenarios, and understand what the code is actually doing. And I'm pretty sure this isn't the only problem waiting to be discovered. In the next video, I'll work on fixing the synchronization bug and improving the system — including how changes are tracked and how devices learn that new data is available. This series follows Brain Assistant as a real-world experiment in AI-assisted solo software development. Can AI actually multiply what one experienced developer is capable of — enough to build and maintain a serious production product alone? That's what I'm trying to find out. #AI #AICoding #PWA #OfflineFirst #LocalFirst #DataSynchronization #SoftwareEngineering #SoloDeveloper #SoftwareDevelopment #Cursor #ChatGPT #SaaS

Why it’s here
  • Search: “local-first software working offline”

Model note: offline sync challenges explained