Skip to content

ElectroJS

ElectroJS is a TypeScript framework for Electron applications built around a module runtime, explicit renderer boundaries, and generated typing between main and renderer.

The documented ElectroJS model is intentionally narrow:

  • ElectroJS is documented for a monorepo-style application layout
  • the recommended shape is one renderer view = one package
  • runtime UI ownership is explicit through @Module({ views, windows })
  • renderer typing is provided through generated electro-env.d.ts files inside each package

If you build outside this shape, you are outside the supported baseline described in these docs.

The shortest supported path is:

bash
npm create electro@latest my-app

Core Ideas

IdeaWhat it means in ElectroJS
Explicit boundariesRenderers can only call bridge methods declared in their @View({ access }) list
Module ownershipA module owns its providers, views, windows, lifecycle, and public runtime API
Generated contractsAccess keys, signal keys, runtime authoring, and renderer bridge typing are code-generated
Electron-first runtimeRuntime and preload are built for Electron, renderers are served by Vite
Practical DXelectro dev handles codegen, renderer dev servers, preload, runtime, and Electron launch

txt
my-app/
├── electro.config.ts
├── pnpm-workspace.yaml
├── package.json
├── runtime/
│   ├── package.json
│   ├── runtime.config.ts
│   ├── electro-env.d.ts
│   └── src/
└── views/
    ├── main/
    │   ├── package.json
    │   ├── view.config.ts
    │   ├── electro-env.d.ts
    │   ├── index.html
    │   └── src/
    └── settings/

ElectroJS generates internal build artifacts under .electro/generated, and the authoring types live in package-local electro-env.d.ts.


Runtime and Renderer

ElectroJS has two execution worlds:

  • runtime: Electron main process, modules, providers, windows, views, jobs, signals
  • renderer: per-view frontend bundles that use @electrojs/renderer

The renderer never talks to Electron directly. It only uses:

  • bridge.<module>.<method>(...)
  • signals.subscribe(...)
  • signals.once(...)

Those APIs are typed from runtime source and each view's declared access/signal surface.


Main Docs

DocumentPurpose
Getting StartedBuild a new app with the recommended workspace layout
Project StructureReference for the supported package layout and dependency ownership
Dev WorkflowWhat dev, generate, build, and preview actually do
Code GenerationWhat ElectroJS generates and why
RendererRenderer bootstrap, bridge, signals, and typing
Views — Runtime SideRuntime-side @View() authoring
WindowsRuntime-side @Window() authoring
ModulesModule composition, imports, exports, and lifecycle ownership
ProvidersInjectable services and internal module logic
SignalsFire-and-forget runtime notifications
JobsBackground and scheduled work
Dependency Injectioninject(), tokens, scopes, and provider resolution
RegistryRuntime registries and scanned application metadata

App Config

defineElectroConfig(...) describes runtime/view package resolution and optional codegen behavior. It is intentionally narrow:

  • explicit runtime package
  • explicit views package list
  • optional codegen.scanDir

Packaging identity and installer metadata are not part of the supported app config surface.