Skip to content

Latest commit

 

History

History
61 lines (41 loc) · 2.43 KB

File metadata and controls

61 lines (41 loc) · 2.43 KB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Commands

npm start          # Start Electron app in development mode (hot reload via Vite)
npm run make       # Build and package the app for distribution
npm run package    # Package without creating installers
npm run lint       # ESLint on all .ts/.tsx files

No test framework is configured yet.

To cut a release, push a version tag — GitHub Actions builds macOS (ARM + Intel) and Windows and attaches the artifacts automatically:

git tag v1.0.0
git push origin v1.0.0

Architecture

This is an Electron + Vite + TypeScript + React + Tailwind CSS 4 desktop app scaffolded with Electron Forge.

Process model

Electron runs two separate JS contexts:

Process Entry point Bundler config
Main (Node.js) src/main.ts vite.main.config.ts
Preload (bridge) src/preload.ts vite.preload.config.ts
Renderer (browser) src/renderer.ts + index.html vite.renderer.config.ts
  • Main process (src/main.ts) — creates BrowserWindow, handles app lifecycle. Node.js APIs are fully available here.
  • Preload script (src/preload.ts) — runs in renderer context but with Node.js access; use contextBridge here to expose safe APIs to the renderer.
  • Renderer (src/renderer.ts) — runs in the browser context. Node.js integration is disabled by default (security default). Communicate with main via IPC (ipcRenderer / ipcMain).

Build output

Electron Forge + the Vite plugin writes compiled output to .vite/. The package.json "main" field points to .vite/build/main.js.

Packaging

forge.config.ts configures:

  • asar packaging enabled
  • Electron Fuses lock down runtime flags (RunAsNode disabled, cookie encryption on, ASAR integrity validation on)
  • Makers: Squirrel (Windows), ZIP (macOS), RPM + DEB (Linux)

IPC pattern

To expose functionality from main to renderer:

  1. Add a contextBridge.exposeInMainWorld(...) call in src/preload.ts
  2. Handle the corresponding ipcMain.handle(...) in src/main.ts
  3. Call window.<api>.<method>() from src/renderer.ts

Global type declarations

forge.env.d.ts declares the Vite-injected globals (MAIN_WINDOW_VITE_DEV_SERVER_URL, MAIN_WINDOW_VITE_NAME) used in src/main.ts to switch between dev-server and production file loading.