frontron
v0.13.3
Published
Init-focused Electron retrofit CLI for existing web frontend projects
Readme
Frontron
frontron is the init-focused retrofit CLI for existing web frontend projects.
Use create-frontron for new apps. Use frontron init when you already have a compatible frontend project and want to add an app-owned Electron layer without replacing the app's existing structure.
Current state
- new apps should start with
create-frontron frontron initis the active command in this packagefrontron doctorchecks the generated Electron layer after initfrontron cleanremoves manifest-owned generated files, package scripts, and package metadata when you want to back out the retrofit layerfrontron updaterefreshes manifest-owned generated files, package scripts, and package metadata through the same guarded plan asinit --forceinitcan now seed a conservativeminimalorstarter-likeElectron layer into a compatible existing web frontend project- the generated Electron files stay app-owned instead of introducing a starter-owned runtime contract
- the current CLI surface is intentionally narrow:
init,doctor,clean, andupdateare supported - the retrofit flow is still starter-derived and intentionally conservative
Recommended start path
npm create frontron@latestThat starter owns its Electron files directly under src/electron/ and uses window.electron for its preload bridge.
Requires Node.js 22.15+.
Retrofit path
If you already have a compatible web frontend project, start with:
npm install -D frontron
npx frontron init
npm install
npm run frontron:devfrontron init is the active retrofit command today.
Use npx frontron init --dry-run first when you want to inspect the detected adapter, planned files, and package.json changes without writing anything.
After init, run your package manager install command again because the retrofit adds Electron-related dependencies to package.json.
Use npm run frontron:package when you are ready to create the packaged desktop app; npm run frontron:build only prepares the desktop build output.
It auto-detects the current runtime adapter when possible:
generic-staticfor Vite-style static frontend buildsnext-exportfor Next.js static export projectsnext-standalonefor Next.js standalone server builds (output: 'standalone')nuxt-node-serverfor Nuxt server buildsremix-node-serverfor Remix node server buildssveltekit-staticfor SvelteKit static exportssveltekit-nodefor SvelteKit node adapter buildsgeneric-node-serverwhen you want to wire a custom Node runtime manually
The generated dev runner prints the local URL it waits for. If your frontend dev server uses a custom host or port, pass it through your existing dev script, for example vite --host 127.0.0.1 --port 4200 or next dev --port 3300.
You can override that detection when needed:
npx frontron init --adapter next-export
npx frontron init --adapter next-standalone
npx frontron init --adapter nuxt-node-server
npx frontron init --adapter remix-node-server
npx frontron init --adapter sveltekit-static
npx frontron init --adapter sveltekit-node
npx frontron init --adapter generic-node-server --server-root build --server-entry server/index.jsIt currently walks through:
- infer the current web frontend scripts first
- ask where the Electron files should live
- default:
electron/
- default:
- ask which desktop script names to add
- defaults:
frontron:dev,frontron:build, andfrontron:package
- defaults:
- ask which preset to use
- defaults:
minimal
- defaults:
- copy a minimal, app-owned Electron layer into the project
- record generated files, scripts, and package metadata ownership in
.frontron/manifest.json - optionally copy a starter-like preload bridge on
window.electron - keep existing web scripts intact unless the user explicitly chooses otherwise
The default preset is minimal. starter-like adds preload.ts, ipc.ts, and src/types/electron.d.ts without replacing the app's existing frontend structure.
Doctor
After init, check the generated Electron layer with:
npx frontron doctordoctor verifies the manifest, generated files, package scripts, Electron build entry, and required dependencies. It reports blockers when the initialized layer is incomplete. If the project has not been initialized yet, it reports that state directly and points you to frontron init.
Clean
Preview cleanup before removing generated files:
npx frontron clean --dry-runRun npx frontron clean --yes to remove only files, package scripts, dependencies, and Electron build metadata recorded in .frontron/manifest.json. Generated file hashes, script commands, and package metadata ownership are checked first, so local edits are preserved unless you pass --force.
Update
Preview a guarded refresh of manifest-owned generated files, scripts, and package metadata:
npx frontron update --dry-runRun npx frontron update --yes to apply the refresh. Internally this uses the same conflict rules as frontron init --force, so only manifest-owned files are overwritten.
License
MIT. Issues: github.com/andongmin94/frontron/issues
