← All writing
6 min read

Shipping a desktop app with Electron and Next.js — what I learned

Master-data tooling that had to live on the desktop AND the web, backed by one Node.js API. Here's the architecture that made both targets share 90% of their code — and the two mistakes I'd avoid next time.

The brief for Mdm-Architecture was hybrid from day one: operations teams wanted a desktop app that felt native and worked fast, while managers wanted the same data available from a browser. Two front ends, one source of truth.

The architecture that worked

  • One Express + MongoDB API serving both clients — no desktop-only shortcuts
  • Electron shell loading a Next.js build, so UI code is written once
  • Report generation centralized server-side with Puppeteer + PDFKit
  • Recharts dashboards reading from the same endpoints as the web client

Mistake one: underestimating packaging

Electron packaging looks like a build step and behaves like a project. Native module versions, code signing, and auto-update channels each ate more time than I budgeted. Next time I'd set up the release pipeline before writing feature code, not after.

Mistake two: letting the desktop client drift

Because the desktop shell had its own lifecycle, it was tempting to ship desktop-only tweaks. Every one of them made the eventual web parity harder. The rule I'd enforce from day one: the API contract is the product, and both clients are thin views over it.

Would I do it again?

Yes — but with stricter boundaries. Electron + Next.js is genuinely productive when the shared API does the heavy lifting, and users genuinely prefer a desktop shell for data-dense daily work. The architecture earns its complexity as long as you defend it.

ElectronNext.jsNode.jsArchitecture

Keep reading