Skip to content

metacurb/electron-ipc-bridge

Repository files navigation

Electron IPC Bridge

Electron IPC Bridge

Electron TypeScript

npm version (@electron-ipc-bridge/core) Core package downloads Vite plugin downloads

A type-safe, class-based IPC framework for Electron. Inspired by NestJS.
Define controllers in main, automatically get fully typed APIs in the renderer.

Documentation · Quickstart · Examples


At a Glance

Controller (main process):

import { IpcController, IpcHandle } from "@electron-ipc-bridge/core";

@IpcController("users")
export class UserController {
  @IpcHandle()
  async getUser(id: string) {
    return { id, name: "Alice" };
  }
}

Renderer:

const user = await window.ipc.users.getUser("123");
console.log(user.name); // "Alice" is fully typed, auto-completed

Features

  • Zero channel boilerplate: channels are generated automatically
  • Auto-generated renderer types: the Vite plugin analyses your controllers and outputs d.ts declarations
  • Parameter injection: @Sender(), @Window(), @RawEvent(), @Channel(), and custom decorators
  • No manual preload wiring: setupPreload() handles everything
  • DI-friendly: bring your own container (TypeDI, NestJS, or a simple factory)

Install

npm install @electron-ipc-bridge/core reflect-metadata
npm install -D @electron-ipc-bridge/vite-plugin

Getting Started

Head to the Quickstart guide for full setup instructions, including TypeScript config, Vite plugin setup, preload wiring, and your first controller.

Documentation

Full documentation is available at metacurb.github.io/electron-ipc-bridge.

License

MIT