# Learnings ## [2026-03-12] Kintone Customize Manager Core Features ### Technical Decisions 1. **Type System Organization** - Created separate type files for domain, kintone, version, and ipc types - Used `Result` pattern for unified IPC response handling - Added path alias `@renderer/*` to tsconfig.node.json for main process imports 2. **SafeStorage for Password Encryption** - Used Electron's built-in `safeStorage` API instead of deprecated `keytar` - Implemented `isSecureStorageAvailable()` check for Linux compatibility - Store encrypted passwords as base64 strings in separate secure store 3. **Kintone API Client** - Used native `fetch` API (Node.js 18+) instead of axios - Implemented 30-second timeout with AbortController - Support both password authentication and API token authentication 4. **IPC Architecture** - All handlers return `{ success: boolean, data?: T, error?: string }` - Used `contextBridge` to expose safe API to renderer - Created typed `ElectronAPI` interface for window.api 5. **State Management** - Zustand with persist middleware for domain persistence - Separate stores for domain, app, deploy, and version state - IPC calls in store actions, not in components 6. **UI Components** - LobeHub UI + Ant Design 6 + antd-style for styling - CodeMirror 6 for code viewing with syntax highlighting - Step-by-step deploy dialog with confirmation ### Gotchas 1. **tsconfig.node.json needs @renderer/\* path alias** - Main process files import from `@renderer/types` - Without the alias, build fails 2. **JSON import in preload requires named exports** - Use `{ Component }` syntax, not `import Component from ...` - Default exports don't work with contextBridge 3. **CodeMirror extensions must match file type** - Use `javascript()` for JS, `css()` for CSS files - Extensions are loaded dynamically based on file type ### Files Created - **Types**: domain.ts, kintone.ts, version.ts, ipc.ts - **Main**: storage.ts, kintone-api.ts, ipc-handlers.ts - **Preload**: index.ts, index.d.ts (updated) - **Stores**: domainStore.ts, appStore.ts, deployStore.ts, versionStore.ts - **Components**: DomainManager/, SpaceTree/, AppDetail/, CodeViewer/, FileUploader/, DeployDialog/, VersionHistory/