126: James Long - Building Distributed Local-First JavaScript Applications
Episode
61 min
Read time
2 min
Topics
Remote Work, Personal Finance, Software Development
AI-Generated Summary
Key Takeaways
- ✓CRDT Architecture: Conflict-free replicated data types enable true offline apps by duplicating data twice—normalized SQLite tables for queries and a messages table with hybrid logical clocks that replay in consistent order across all devices without conflicts.
- ✓Merkle Tree Syncing: Sync protocol uses Merkle trees to hash message chunks hierarchically, comparing single root hashes between clients to identify divergence points, then walking down tree branches to find exact messages needing sync without transferring entire databases.
- ✓Eventual Consistency Trade-offs: Apps must handle temporarily inconsistent data by normalizing database structure maximally, never deleting records (only tombstone flags), and querying only fully-consistent data at read time to prevent foreign key references to nonexistent records during sync.
- ✓Security Considerations: Electron apps allow JavaScript modification by unpacking and repacking, creating phishing risks for sensitive data like banking credentials. Service workers in browsers provide better security guarantees through sandboxing, making web-based local-first apps potentially more secure.
- ✓Service Worker Backend: Web implementation would run entire backend logic in service worker with IndexedDB for messages and WebAssembly-compiled SQLite in memory, enabling multiple browser tabs to sync instantly through single background process while maintaining offline functionality.
What It Covers
James Long explains building Actual, a local-first budgeting app using CRDTs for offline-first sync without central database, leveraging SQLite, Electron, and distributed systems concepts from backend architecture applied to client applications.
Key Questions Answered
- •CRDT Architecture: Conflict-free replicated data types enable true offline apps by duplicating data twice—normalized SQLite tables for queries and a messages table with hybrid logical clocks that replay in consistent order across all devices without conflicts.
- •Merkle Tree Syncing: Sync protocol uses Merkle trees to hash message chunks hierarchically, comparing single root hashes between clients to identify divergence points, then walking down tree branches to find exact messages needing sync without transferring entire databases.
- •Eventual Consistency Trade-offs: Apps must handle temporarily inconsistent data by normalizing database structure maximally, never deleting records (only tombstone flags), and querying only fully-consistent data at read time to prevent foreign key references to nonexistent records during sync.
- •Security Considerations: Electron apps allow JavaScript modification by unpacking and repacking, creating phishing risks for sensitive data like banking credentials. Service workers in browsers provide better security guarantees through sandboxing, making web-based local-first apps potentially more secure.
- •Service Worker Backend: Web implementation would run entire backend logic in service worker with IndexedDB for messages and WebAssembly-compiled SQLite in memory, enabling multiple browser tabs to sync instantly through single background process while maintaining offline functionality.
Notable Moment
James reveals his concern about launching bank credential syncing in Electron, explaining how attackers could modify the app's JavaScript to harvest passwords. He plans redirecting users to browsers for credential entry where URL bars provide verifiable security guarantees that desktop apps cannot offer.
Episode Transcript
In this episode of Fullstack Radio I talked to James Long about building Actual, a distributed local first JavaScript application with no central database. This is Fullstack Radio episode one twenty six. Hey, everyone. Welcome to another episode of the Fullstack Radio podcast. I'm your host, Adam Wavin. And today, it's my pleasure to be speaking with James Long, who you are probably most familiar as the creator of Prettier, which is a tool that's sort of taken the web by storm at this point. I think, basically, everyone is using it. I can't really remember what it was like to have to think about formatting files. Now I just, like, type stuff, the code goes wherever it wants on the screen, and command s, alright, everything's cleaned up again. But today, what I wanted to talk to you about, James, is not Prettier because, you've probably talked about prettier to death at this point, but I wanted to dig into this new application you're working on, this new, kind of software business you're building called actual, which is a tool for helping people sort of manage their personal budgets and stuff like that. So the thing I was most excited to talk to you about is sort of the way that you've decided to approach building this app, which I think is a bit different from how a lot of people working on the web would have approached, building something, and that is that you're building this app, I believe it's like an electron app currently, but the whole thing is designed to, like, not require network access at all. Is that right? Yes. So it started as a desktop application, and so it kind of started from just the typical local app, which, you know, is that's not really innovative at all by itself. It's just a local app, and then it grew into this thing where I was like, oh, crap. I need a mobile app, which means crap I need to sync them somehow and then it just sort of, I kind of fell into it in a way. But yeah I have always loved the honestly I've always loved like local desktop apps they're just like super fast they're always there and then so I was kind of bending over backwards to try to keep that experience but still have kind of the capabilities of what the web offers and so I kind of took a lot of like several years of just kind of learning and prototyping, and I've kind of fell into this interesting pattern. So I kind of came at it from a different angle. Yeah. So I think it'd be cool to sort of dig into that and learn more about, like, what that even means and how other people can kind of use some of these ideas to sort of build something like this themselves. So I guess maybe like the first place, to start coming at this as someone …
Get the full transcript (12,179 words) + summary by email — free
One-time email with the complete transcript and AI summary of this episode. No account needed.
One email, no spam. We’ll also show you what SignalCast does.
You just read a 3-minute summary of a 58-minute episode.
Get Full Stack Radio summarized like this every Monday — plus up to 2 more podcasts, free.
Pick Your Podcasts — FreeKeep Reading
More from Full Stack Radio
153: DHH – Omarchy and Designing Your Own OS on Arch Linux
Aug 21 · 76 min
The Knowledge Project
James Clear: How to Build Good Habits & Break Bad Ones
Jan 1
More from Full Stack Radio
152: Ben Orenstein - How to Stand Out When Applying for a Job at a Small Company
Jan 28 · 47 min
Odd Lots
NYT CEO Meredith Kopit Levien on Running a Media Brand in the Age of AI
Aug 10
Books, tools, and gear mentioned in this episode
SignalCast may earn commission on purchases via these links. As an Amazon Associate, SignalCast earns from qualifying purchases.
Tools
“leveraging SQLite, Electron, and distributed systems concepts from backend architecture applied to client applications.”
Gear
More from Full Stack Radio
We summarize every new episode. Want them in your inbox?
153: DHH – Omarchy and Designing Your Own OS on Arch Linux
152: Ben Orenstein - How to Stand Out When Applying for a Job at a Small Company
151: DHH – Building HEY with Hotwire
150: Secret Screencasting Tips & Behind the Scenes of Tailwind CSS 2.0
149: Choosing a Payment Processor, Radical Icons & W3C Hype
Similar Episodes
Related episodes from other podcasts
The Knowledge Project
Jan 1
James Clear: How to Build Good Habits & Break Bad Ones
Odd Lots
Aug 10
NYT CEO Meredith Kopit Levien on Running a Media Brand in the Age of AI
David Senra
Aug 2
Micky Malka, Founder of Ribbit Capital
The Diary of a CEO
May 29
Most Replayed Moment: The Hidden Organ That Controls Exactly How You Age!
Odd Lots
May 22
'The Assassin' Fahmi Quadir on How to Survive as a Short-Seller
Explore Related Topics
This podcast is featured in Best Cybersecurity Podcasts (2026) — ranked and reviewed with AI summaries.
Read this week's Software Engineering Podcast Insights — cross-podcast analysis updated weekly.
You're clearly into Full Stack Radio.
Every Monday, we deliver AI summaries of the latest episodes from Full Stack Radio and 192+ other podcasts. Free for one show.
Start My Monday DigestNo credit card · Unsubscribe anytime