Skip to main content
Full Stack Radio

126: James Long - Building Distributed Local-First JavaScript Applications

61 min episode · 2 min read
·
James Long

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.

Know someone who'd find this useful?

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.

Browse all Full Stack Radio transcripts →

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 — Free

Keep Reading

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

  • leveraging SQLite, Electron, and distributed systems concepts from backend architecture applied to client applications.

Products

  • ActualBy guest
    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.

More from Full Stack Radio

We summarize every new episode. Want them in your inbox?

Similar Episodes

Related episodes from other podcasts

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 Digest

No credit card · Unsubscribe anytime