remove-auth-from-electron-react-applisted
Install: claude install-skill milodule3-debug/aura-code
When removing a cross-cutting concern like Firebase authentication + cloud sync from an Electron + React app, the dependency spans three architectural layers that must each be addressed:
1. **Renderer process** (React): services, stores, components, pages
2. **Main process** (Electron): IPC handlers, CSP headers, `BrowserWindow` popup/open handlers, navigation allow-lists
3. **Preload bridge**: `contextBridge.exposeInMainWorld` entries that expose auth IPC to the renderer
**Why:** Deleting just the Firebase service file (`firebase.js`) leaves dangling imports in stores (Zustand), UI components (header, settings), layout init calls, and IPC handlers in the Electron main process. The app will crash at import-time or fail silently with broken UI. Each layer must be traced and cleaned.
**How to apply:**
### Step 1 — Map all touchpoints with grep
```bash
grep -r "firebase\|googleSignIn\|authStore\|onAuthChange" src/ electron/
```
### Step 2 — Clean renderer layer (top-down)
- **Service file** (`src/services/firebase.js`): delete entirely
- **Auth store** (`src/store/authStore.js`): delete entirely (Zustand store that wraps Firebase auth)
- **Stores that call Firebase** (e.g. `clipboardStore.js`): remove imports (`auth`, `syncClipToCloud`, `deleteClipFromCloud`), remove helper (`getCloudUser`), remove cloud-sync blocks inside `addItem`/`updateItem`/`deleteItem`
- **Layout components** (`Layout.jsx`, `MobileLayout.jsx`): remove `useAuthStore` import, `initAuth()` call, and u