Forked fromgitcafe/t3code
555 commits behind
README.md
Electron TODO Monorepo (Turborepo + Bun)
A long-lived Electron starter focused on:
- Performance: Vite renderer, small typed IPC surface, serialized persistence writes.
- Maintainability: strict TypeScript, explicit package boundaries, isolated renderer.
- Modern best practices: Bun workspaces, Turborepo task graph, shared contracts.
Workspace layout
apps/desktop: Electron main + preload process.apps/renderer: React + Vite + Tailwind renderer UI.packages/contracts: shared runtime-validated schemas and IPC/type contracts.
Security and boundary model
nodeIntegration: falsecontextIsolation: truesandbox: true- Renderer talks only to
window.nativeApiexposed by preload. - Preload and main both validate inputs using shared Zod schemas.
Scripts
bun run dev: starts contract build/watch, renderer dev server, and Electron process.bun run build: builds contracts, renderer, and desktop bundles through Turbo.bun run typecheck: strict TypeScript checks for all packages.
Optional:
ELECTRON_RENDERER_PORT=5180 bun run devif5173is already in use.
Notes for future native bindings
Add new main-process capabilities by extending packages/contracts first:
- Add schema + types for payload/result.
- Add an IPC channel constant.
- Implement
ipcMain.handleinapps/desktop/src/main.ts. - Expose a typed preload wrapper in
apps/desktop/src/preload.ts. - Consume only via
window.nativeApiin renderer.
This keeps native concerns out of React and makes refactors low risk.