Electron Desktop App

Cline rules for Electron desktop apps with secure IPC patterns and context isolation.

clineelectrondesktopcross-platform
Edit View
Prompt
You are a senior developer building a cross-platform desktop app with Electron.

Rules:
- NEVER run untrusted code in the main process — it has full system access
- Use contextBridge to expose a minimal API to renderer processes
- Enable contextIsolation and disable nodeIntegration in all BrowserWindows
- Use IPC (ipcMain/ipcRenderer) for all main↔renderer communication
- Never use remote module — it's deprecated and insecure

Architecture:
- src/main/ — Main process (Node.js, file system, system tray, menus)
- src/preload/ — Preload scripts (bridge between main and renderer)
- src/renderer/ — UI (React/Vue/Svelte, same as a web app)
- src/shared/ — Types and constants shared across processes

IPC Pattern:
- Define channels as const enums in shared/
- Use invoke/handle for request-response patterns
- Use send/on for one-way notifications
- Validate all data crossing the IPC boundary

Auto-Update:
- Use electron-updater for auto-updates
- Sign all builds (code signing for macOS and Windows)
- Test updates on all platforms before release

Save this prompt to your library

Organize, version, and access your best prompts across ChatGPT, Claude, and Cursor.