# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Development Commands **Development** - `npm run dev` - Start development server with Vite (includes --host flag) - `npm run build` - Build for production (includes TypeScript check with vue-tsc -b) - `npm run preview` - Preview production build locally - `npm run analyze` - Build with bundle analysis (opens visualization) **Electron Development** - `npm run electron:dev` - Run both Vite dev server and Electron concurrently - `npm run electron:build` - Full build and package for Electron - `npm run start` - Start Electron using Forge - `npm run package` - Package Electron app with Forge - `npm run make` - Create distributables with Electron Forge ## Architecture Overview This is a modular Vue 3 + TypeScript + Vite application with Electron support, featuring a Nostr protocol client and Lightning Network integration for events/ticketing. ### **Modular Architecture** The application uses a plugin-based modular architecture with dependency injection for service management: **Core Modules:** - **Base Module** (`src/modules/base/`) - Core infrastructure (Nostr, Auth, PWA) - **Nostr Feed Module** (`src/modules/nostr-feed/`) - Social feed functionality - **Chat Module** (`src/modules/chat/`) - Encrypted Nostr chat - **Events Module** (`src/modules/events/`) - Event ticketing with Lightning payments - **Market Module** (`src/modules/market/`) - Nostr marketplace functionality **Module Configuration:** - Modules are configured in `src/app.config.ts` - Each module can be enabled/disabled and configured independently - Modules have dependencies (e.g., all modules depend on 'base') **Plugin Manager:** - `src/core/plugin-manager.ts` handles module lifecycle - Registers, installs, and manages module dependencies - Handles route registration from modules ### **Dependency Injection Pattern** **CRITICAL**: Always use the dependency injection pattern for accessing shared services: **Service Registration (Base Module):** ```typescript // src/modules/base/index.ts import { container, SERVICE_TOKENS } from '@/core/di-container' container.provide(SERVICE_TOKENS.RELAY_HUB, relayHub) container.provide(SERVICE_TOKENS.AUTH_SERVICE, auth) ``` **Service Consumption (Other Modules):** ```typescript // In any module's composables or services import { injectService, SERVICE_TOKENS } from '@/core/di-container' const relayHub = injectService(SERVICE_TOKENS.RELAY_HUB) const authService = injectService(SERVICE_TOKENS.AUTH_SERVICE) ``` **❌ NEVER do this:** ```typescript // DON'T import services directly - breaks modular architecture import { relayHubComposable } from '@/composables/useRelayHub' ``` **✅ Always do this:** ```typescript // DO use dependency injection for loose coupling const relayHub = injectService(SERVICE_TOKENS.RELAY_HUB) ``` **Available Services:** - `SERVICE_TOKENS.RELAY_HUB` - Centralized Nostr relay management - `SERVICE_TOKENS.AUTH_SERVICE` - Authentication services - `SERVICE_TOKENS.VISIBILITY_SERVICE` - App visibility and connection management **Core Stack:** - Vue 3 with Composition API (`