# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Project Overview ERitors Scribe is an Electron + Next.js desktop application for writers. It uses SQLite with WASM for local storage, supports offline mode with PIN authentication, and encrypts user data with AES-256-CBC. ## Commands ```bash # Development (starts Next.js on port 4000 + Electron with hot reload) npm run dev # Build for specific platform npm run build:mac npm run build:win npm run build:linux npm run build:all ``` ## Architecture ### Process Model ``` Renderer (Next.js) <--IPC--> Main Process <--> SQLite DB via window.electron.invoke() ``` - **Main process**: `electron/main.ts` - Window management, IPC handlers, OS integration - **Preload script**: `electron/preload.ts` - Secure contextBridge API - **Renderer**: Next.js App Router with static export (`output: 'export'`) ### Key Directories - `electron/` - Main process code (IPC handlers, database, storage) - `electron/ipc/` - IPC handlers organized by domain (book, chapter, character, etc.) - `electron/database/` - SQLite service, models, repositories, encryption - `electron/storage/SecureStorage.ts` - OS-level secure storage (macOS Keychain, Windows DPAPI) - `app/` - Next.js pages (App Router) - `context/` - React contexts for state management (13+ contexts) - `components/` - React components - `lib/locales/` - i18n translations (fr.json, en.json) ### IPC Handler Pattern All IPC handlers use `createHandler
()` factory in `electron/database/LocalSystem.ts`: ```typescript // electron/ipc/book.ipc.ts ipcMain.handle('db:book:books', createHandler