Claude Code plugin for type-safe IPC communication in Electron applications using Hono RPC
npx claudepluginhub naporin0624/claude-plugin-hono-electronType-safe IPC communication for Electron applications using Hono RPC, CQRS architecture, and reactive state management. Provides factory pattern with DI, Observable queries, ResultAsync commands, and Jotai hybrid atoms.
A Claude Code plugin for implementing type-safe IPC communication in Electron applications using Hono RPC, CQRS architecture, and reactive state management.
/plugin marketplace add napochaan/hono-electron-ipc
/plugin install hono-electron-ipc
claude --plugin-dir ./hono-electron-ipc
/hono-electron-ipc:init
This scaffolds the complete directory structure:
src/
├── shared/
│ └── callable/
│ ├── index.ts # Factory and app creation
│ └── types.d.ts # Type export for client
├── main/
│ └── callable/
│ └── index.ts # Service injection
└── renderer/
└── src/
└── adapters/
└── client.ts # Type-safe hc client
/hono-electron-ipc:add-route users
Creates a new route with Zod validation:
// src/shared/callable/users/index.ts
import { zValidator } from '@hono/zod-validator';
import { Hono } from 'hono';
import { z } from 'zod';
const app = new Hono<HonoEnv>();
export const routes = app
.get('/', (c) => c.json({ users: [] }))
.get('/:id', (c) => c.json({ id: c.req.param('id') }));
import { client } from '@adapters/client';
// Full autocomplete and type checking!
const res = await client.users[':id'].$get({ param: { id: 'usr_123' } });
const user = await res.json();
/hono-electron-ipc:new-service users
Creates a CQRS service:
export class UserServiceImpl implements UserService {
#notify = new BehaviorSubject(Date.now());
// Query: Observable for reactive data streams
list(): Observable<User[]> {
return concat(
from(this.#getUsers()),
this.#notify.pipe(mergeMap(() => this.#getUsers()))
);
}
// Command: ResultAsync for type-safe operations
create(data: CreateUserData): ResultAsync<void, Error> {
return this.#insertUser(data)
.andThen(() => {
this.#notify.next(Date.now());
return okAsync(void 0);
});
}
}
/hono-electron-ipc:new-hybrid-atom users
Creates a hybrid atom (stream + HTTP fallback):
// Stream atom (IPC subscription)
const streamUsersAtom = atom<{ value: User[] }>();
streamUsersAtom.onMount = (set) => {
const handler = debounce(async () => {
const data = await client.users.$get().then(r => r.json());
set({ value: data });
}, 300);
handler();
return usersSource.subscribe(handler);
};
// Hybrid selector
export const usersAtom = atom(async (get) => {
const stream = get(streamUsersAtom);
if (stream === undefined) return get(singleFetchAtom);
return stream.value;
});
/hono-electron-ipc:new-route users
Creates a route with CQRS service integration:
const route = new Hono()
.get('/', async (c) => {
const users = await firstValueFromResult(
c.var.services.users.list()
);
return users.match(
(data) => c.json(data, 200),
(error) => c.json({ error: error.message }, 500)
);
});
// Client: Full type inference
const users = await client.users.$get().then(r => r.json());
/hono-electron-ipc:migrate
This orchestrates a full migration from traditional IPC to Hono:
ipcMain.handle and ipcRenderer.invoke calls| Command | Description |
|---|---|
/hono-electron-ipc:init | Initialize Hono IPC architecture |
/hono-electron-ipc:add-route [name] | Add a basic route with validation |
/hono-electron-ipc:migrate | Migrate existing IPC to Hono |
| Command | Description |
|---|---|
/hono-electron-ipc:new-service [name] | Create CQRS service with Observable/ResultAsync |
/hono-electron-ipc:new-route [name] | Create route with CQRS integration |
/hono-electron-ipc:new-hybrid-atom [name] | Create Jotai hybrid atom with IPC subscription |
Auto-triggers when discussing IPC setup, Hono for Electron, or type-safe IPC.