DEV Community

Trpn
Trpn

Posted on

The Road to Local-First: Moving from Supabase to an Electron + IndexedDB Stack

thePathI decided to step out of the corporate "C# shop" bubble and build something for myself: a work-logger and invoicing tool for my upcoming freelance career. As the tool took shape, it dawned on me there could be other freelancers who, like me, might also be interested in a simple and local-first tool like this, so I decided to polish it for a public release.

What started as a simple "learning project" turned into a 16-month architectural odyssey. I built this app three times over 6 months, progressively stripping away layers of "modern" cloud complexity until I reached the only thing that actually mattered: Reliability.

Phase 1: The Cloud Liability (Supabase)

I started with the standard modern stack: SvelteKit + Supabase. It felt great at first ... until it didn't.

  • The Friction: As a freelancer, I realized my data is a non-negotiable asset. Dealing with Row Level Security (RLS) policies felt like an "extra" tax I didn't need for a personal tool.
  • The "Wake Up" Call: Supabase kept emailing me that my project was 'going to sleep' due to inactivity (the reality of the free-tier, but a wake-up call nonetheless). I also realized I didn't want my clients' private project data living on anyone's cloud, no matter how secure they claim to be.

The Pivot: I decided to go Local-First.

Phase 2: The Persistence Puzzle (Dexie & IndexedDB)

I swapped the cloud for IndexedDB using Dexie.js. Felt like a major shift in thinking in moving from direct SQL queries to a reactive, client-side data layer.

  • The Win: 100% privacy. Zero latency. No "sleep cycles."
  • The Lesson: Privacy isn't just a feature; it's an architectural choice. By removing the server, I removed the biggest point of failure.

Phase 3: The Distribution Dilemma (PWA vs. Electron)

How do you deliver a local-first app?

  • The PWA Attempt: I tried the PWA route, but the "Service Worker Wall" is real. Relying on a browser that might clear history or discard a cache felt too risky for financial (invoicing) data. If I couldn't guarantee it would work offline 100% of the time, I couldn't ship it.

  • The Tauri Wall: I loved the idea of Rust/Tauri, but my dev environment is strictly containerised. Tauriโ€™s need to hook into the host OS's graphic libraries created a friction point I wasn't willing to fight.

  • The Electron Solution: I landed on Electron. Yes, the bundle size is larger. Yes, it brings its own Chromium. But it works. It gave me a self-contained, guaranteed environment where my data stays on the machine and the app works regardless of the browser's mood.

Reflections of a "Legacy" Dev in a Modern World

This journey taught me that 18 years of "logic-building" in .NET can translate to modern stacks like Svelte and Electron if you're willing to embrace the friction. I traded the "mind-taxing" corporate patterns for a stack that I actually control.

Explore the Project:

Grab the Free Portable .exe: If you just want to see the local-first performance in action.
Technical Showcase & Specs: For further info on the architecture and specs.

Top comments (0)