An open API service indexing awesome lists of open source software.

https://github.com/metacurb/electron-ipc-bridge

Type-safe, class-based IPC for Electron
https://github.com/metacurb/electron-ipc-bridge

dependency-injection electron electronjs vite

Last synced: 4 months ago
JSON representation

Type-safe, class-based IPC for Electron

Awesome Lists containing this project

README

          


Electron IPC Bridge

Electron IPC Bridge


Electron
TypeScript


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):

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

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

**Renderer**:

```ts
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

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

## Getting Started

Head to the **[Quickstart guide](https://metacurb.github.io/electron-ipc-bridge/quickstart)** 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](https://metacurb.github.io/electron-ipc-bridge/)**.

## License

MIT