mrcen3204097569-spec/lean-electron-vue

Developer Tools

A readable Electron + Vite + Vue 3 + TS desktop template that skips third-party integration plugins so you can modify the build yourself.

152
3
TypeScript
MIT
2 days old

If you want an Electron desktop starter whose build pipeline you can actually read, this template is worth a look; anyone expecting a general-purpose scaffold or turnkey packaging support should look elsewhere.

The problem

Starting a Vue desktop app usually means wiring Vite to Electron, handling dev-server URLs, preload compilation and packaging. Common integration plugins hide that wiring, so when main-process reloads or build output go wrong, you debug someone else's abstraction. This template keeps the bridge to two thin custom plugins, so dev startup, build and packaging happen in code you can open and edit. The result is a runnable desktop skeleton with dev HMR, a dist/ build and a release/ installer path.

What's different

pnpm dev starts Vite, compiles the main process with esbuild and launches Electron with VITE_DEV_SERVER_URL; main-process changes recompile and restart, preload changes recompile and reload the window. pnpm build builds the renderer and main process without invoking electron-builder, while only pnpm dist adds packaging. That split is practical when you want to test the app before settling installer config.

Security defaults are explicit: context isolation and sandbox on, Node integration and <webview> off, all privilege through a preload contextBridge. The window-open handler accepts only whitelisted options, restricts navigation to app:// or the dev origin, and sends external links to the system browser. The trade-off is that every new renderer capability must be declared explicitly, which is deliberate friction rather than zero-config convenience. Auto-update uses electron-updater with a check-download-install dialog, but the README warns that the publish URL must be HTTPS in production; its http://127.0.0.1 setting is for local debugging only. All dependencies sit in devDependencies, and the main process including electron-updater is bundled into mainEntry.js, so the installer needs no node_modules; when something breaks in the main process, you inspect the bundle.

Who should try it

A good fit is a developer who knows Vue 3 and wants a small Electron starting point for an internal tool or single-window utility, preferring to adjust a few dozen lines of plugin code over learning an integration framework. The custom title bar, app:// protocol and history routing example cover common setup needs. A poor fit is a team building a large cross-platform product needing a broad Electron plugin ecosystem, or someone unwilling to own build scripts at all, since the template deliberately makes the pipeline their responsibility.

Requirements and limitations

Node.js ^20.19.0 or >=22.12.0 and pnpm 10 are required, ruling out older Node installations. Electron 45 downloads its binary on first run, and electron-builder fetches extra tooling when packaging; on slow networks you must set the Electron and electron-builder mirrors described in the project instructions. Tests cover only pure logic such as app:// path validation, update YAML, window policy and CSP, not UI behavior or packaging.

Auto-update also has ongoing upkeep: bump the package.json version, run pnpm dist, and upload the installer, .blockmap and latest*.yml files to an HTTPS update server. Packaging examples target Windows NSIS, macOS dmg and Linux AppImage, but the CI matrix building all three runs only on manual trigger or v* tags, so routine pushes do not validate every platform's installer.

HotRepo's take

HotRepo has tracked this repository since 2026-10-24 and recorded a NEW-REPOSITORY board (新项目榜, TypeScript) entry at #17 with 152 total stars on 2026-10-25. That is a two-date snapshot of a two-day-old project, not daily growth, so persistence cannot yet be judged. Before committing, check whether its pinned Node and Electron versions match your target platforms' packaging needs.

Written by AI from the project's README, updated October 25, 2026. The project's own docs are the source of truth.