feat: US-003 — electron-trpc IPC bridge and appRouter scaffold

- Install electron-trpc, @trpc/server, @trpc/client, @trpc/react-query, @tanstack/react-query, zod
- Create appRouter in src/main/router/index.ts with stub routers for: health, clients, projects, tasks, checkpoints, notes, ai
- health.ping procedure returns 'pong'
- All procedure inputs validated with Zod schemas
- Configure IPC handler in main process (createIPCHandler) and preload (exposeElectronTRPC)
- Create renderer trpc client in src/renderer/lib/trpc.ts with ipcLink
- Wrap app with TRPCProvider + QueryClientProvider in src/renderer/index.tsx
- Verify health.ping in HomePage component (shows 'tRPC IPC bridge: pong')
- Typecheck passes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Roberto Musso
2026-02-19 16:41:52 +01:00
parent b5a9b18be4
commit 5254d13e4e
9 changed files with 338 additions and 78 deletions

View File

@@ -1,14 +1,16 @@
import { app, BrowserWindow } from 'electron';
import path from 'node:path';
import started from 'electron-squirrel-startup';
import { createIPCHandler } from 'electron-trpc/main';
import { initDb } from './db';
import { appRouter } from './router';
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
if (started) {
app.quit();
}
const createWindow = () => {
const createWindow = (): BrowserWindow => {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 1280,
@@ -36,6 +38,8 @@ const createWindow = () => {
if (process.env.NODE_ENV === 'development') {
mainWindow.webContents.openDevTools();
}
return mainWindow;
};
// This method will be called when Electron has finished
@@ -43,7 +47,8 @@ const createWindow = () => {
// Some APIs can only be used after this event occurs.
app.on('ready', () => {
initDb();
createWindow();
const win = createWindow();
createIPCHandler({ router: appRouter, windows: [win] });
});
// Quit when all windows are closed, except on macOS. There, it's common