Skip to content

Installation

Prerequisites

  • Node.js ≥ 18.0.0
  • Electron ≥ 28.0.0
  • TypeScript ≥ 5.0.0 (strict mode recommended)
  • A package manager: npm, pnpm, or yarn

Install the Package

bash
pnpm add @number10/electron-ipc
bash
npm install @number10/electron-ipc
bash
yarn add @number10/electron-ipc

The package ships with:

  • The code generator CLI (electron-ipc-generate)
  • All runtime helpers (handler base classes, validation adapters, window manager, inspector)
  • TypeScript declarations for everything

Peer Dependencies

You need these in your project (they are not bundled):

PackageWhy
electronIPC primitives (ipcMain, ipcRenderer, contextBridge)
typescriptContract type definitions
yamlYAML config parsing for the generator

Install them if not already present:

bash
pnpm add -D electron typescript
pnpm add yaml

CLI Setup

Add a generate script to your package.json:

json
{
  "scripts": {
    "generate": "electron-ipc-generate --config=./ipc-config.yaml",
    "generate:watch": "electron-ipc-generate --config=./ipc-config.yaml --watch"
  }
}

The generator needs a YAML config file — see Quick Start to create one.

Optional: Scaffold a New Project

To get a complete Electron + Vite + React app with IPC contracts pre-configured:

bash
pnpm dlx @number10/create-electron-ipc
bash
npm create @number10/electron-ipc
bash
npx @number10/create-electron-ipc

This scaffolds everything: contracts, generator config, preload, handlers, and optionally the IPC Inspector and validation adapters.

Verify Installation

bash
# Check the CLI is available
npx electron-ipc-generate --help

# Or via the script you added:
pnpm run generate --help

Next Step

Head to Quick Start to wire up your first IPC call in under 5 minutes.