# Contributors Guide Welcome to the Ziya Token Monitor development team! This guide will help you get up and running quickly with the project. ## ๐Ÿš€ Quick Start for New Developers ### Prerequisites Make sure you have these installed: - **Node.js** >= 18.0.0 - **pnpm** >= 8.0.0 (package manager) - **Redis** (for local development) - **Git** for version control ### Installation Steps 1. **Clone the repository**: ```bash git clone cd muhafidh/ziya ``` 2. **Install dependencies**: ```bash pnpm install ``` 3. **Set up Redis** (choose one): **Option A: Docker (Recommended)** ```bash # Run Redis in Docker container docker run -d --name bismillahdao-redis -p 6379:6379 redis:alpine ``` **Option B: Local Installation** ```bash # Install Redis locally (varies by OS) # macOS: brew install redis # Ubuntu: sudo apt install redis-server # Windows: Use WSL or Redis for Windows ``` 4. **Start development**: ```bash pnpm run dev ``` The application will start with: - Nuxt dev server at `http://localhost:3000` - Electron desktop app will launch automatically - Hot reload enabled for both frontend and Electron ## ๐Ÿ—๏ธ Development Architecture ### Tech Stack Overview - **Frontend**: Vue 3 (Vapor Mode), Nuxt 3, TypeScript - **Desktop**: Electron with secure IPC communication - **Styling**: TailwindCSS + DaisyUI - **State Management**: Pinia - **Backend Integration**: Redis (ioredis) for real-time events - **Build Tools**: Vite, Electron Forge ### Project Structure Deep Dive ``` ziya/ โ”œโ”€โ”€ app/ # Nuxt 3 application โ”‚ โ”œโ”€โ”€ components/ # Vue components โ”‚ โ”‚ โ”œโ”€โ”€ TokenCard.vue # Individual token display cards โ”‚ โ”‚ โ”œโ”€โ”€ CexAnalysisCard.vue # CEX analysis results โ”‚ โ”‚ โ””โ”€โ”€ ... โ”‚ โ”œโ”€โ”€ pages/ # Nuxt pages/routes โ”‚ โ”‚ โ””โ”€โ”€ hunting-ground.vue # Main dashboard โ”‚ โ”œโ”€โ”€ stores/ # Pinia state management โ”‚ โ”œโ”€โ”€ utils/ # Utility functions โ”‚ โ”‚ โ”œโ”€โ”€ address.ts # Solana address handling โ”‚ โ”‚ โ”œโ”€โ”€ format.ts # Data formatting โ”‚ โ”‚ โ””โ”€โ”€ ... โ”‚ โ””โ”€โ”€ types/ # TypeScript definitions โ”œโ”€โ”€ electron/ # Electron main process โ”‚ โ”œโ”€โ”€ main.ts # Electron entry point โ”‚ โ”œโ”€โ”€ config/ # Configuration files โ”‚ โ”‚ โ”œโ”€โ”€ environment.ts # Environment settings โ”‚ โ”‚ โ””โ”€โ”€ redis.ts # Redis configuration โ”‚ โ”œโ”€โ”€ handlers/ # Event handlers โ”‚ โ”œโ”€โ”€ utils/ # Electron utilities โ”‚ โ”‚ โ””โ”€โ”€ redis.ts # Redis connection logic โ”‚ โ””โ”€โ”€ preload.ts # Preload script for IPC โ”œโ”€โ”€ types/ # Shared TypeScript types โ”‚ โ””โ”€โ”€ redis-events.ts # Redis event definitions โ””โ”€โ”€ .config/ # Configuration files โ””โ”€โ”€ nuxt.ts # Nuxt configuration ``` ## ๐Ÿ”ง Development Workflow ### Available Scripts ```bash # Development pnpm run dev # Start development with hot reload pnpm run dev:nuxt # Start only Nuxt dev server pnpm run dev:electron # Start only Electron (requires built Nuxt) # Building pnpm run build # Production build pnpm run build:dev # Development build pnpm run build:prod # Production build (explicit) # Utilities pnpm run lint # Run ESLint pnpm run type-check # TypeScript type checking ``` ### Environment Configuration The application automatically detects the environment and configures Redis accordingly: **Development Mode** (`NODE_ENV=development`): - Redis: `localhost:6379` or `bismillahdao-redis:6379` (Docker) - Hot reload enabled - Debug logging active **Production Mode** (`NODE_ENV=production`): - Redis: `154.38.185.112:6379` (production server) - Optimized builds - Minimal logging ### Key Configuration Files - `electron/config/environment.ts` - Environment-specific settings - `electron/config/redis.ts` - Redis connection configuration - `.config/nuxt.ts` - Nuxt configuration - `package.json` - Build scripts and dependencies ## ๐ŸŽฏ Core Features & Components ### Real-time Token Dashboard **Location**: `app/pages/hunting-ground.vue` - Displays three columns of token events - Real-time updates via Redis subscriptions - Individual and bulk card management ### Token Cards System **Components**: - `TokenCard.vue` - New token creation events - `CexAnalysisCard.vue` - CEX analysis and max depth events **Features**: - Duration calculation from timestamps - Creator information display - Graph visualization with hover tooltips - Click-to-open in browser functionality - Individual close buttons and "Clear All" actions ### Redis Integration **Location**: `electron/utils/redis.ts` - Subscribes to channels: `new_token_created`, `token_cex_updated`, `max_depth_reached` - Handles connection management and error recovery - Forwards events to renderer process via IPC ## ๐Ÿ› Common Development Issues & Solutions ### Redis Connection Issues **Problem**: `ECONNREFUSED` when connecting to Redis **Solutions**: 1. Ensure Redis is running: `redis-cli ping` 2. Check Docker container: `docker ps | grep redis` 3. Verify port 6379 is not blocked ### Build Errors **Problem**: TypeScript compilation errors **Solutions**: 1. Run type check: `pnpm run type-check` 2. Clear node_modules: `rm -rf node_modules && pnpm install` 3. Check for missing dependencies ### Hot Reload Not Working **Problem**: Changes not reflecting in development **Solutions**: 1. Restart dev server: `Ctrl+C` then `pnpm run dev` 2. Clear Nuxt cache: `rm -rf .nuxt` 3. Check if both Nuxt and Electron processes are running ## ๐Ÿ“ Code Style & Best Practices ### TypeScript Guidelines - Use strict type definitions for all Redis events - Prefer interfaces over types for object shapes - Use proper error handling with try-catch blocks ### Vue Component Guidelines - Use Composition API with `