# Ziya Token Monitor A modern Electron-based desktop application for monitoring Solana token creation, CEX findings, and developer balance source graphs. Built with React, Redux, and TypeScript. ## Architecture This project follows a modular architecture with three main packages: ### πŸ“¦ Packages - **`@ziya/shared`** - Shared types, utilities, and domain models - **`@ziya/frontend`** - React frontend with Redux state management - **`@ziya/backend`** - Electron main process with Redis integration ### πŸ—οΈ Tech Stack - **Frontend**: React 18, Redux Toolkit, TypeScript, Styled Components, Vite - **Backend**: Electron, Node.js, TypeScript, Redis (ioredis) - **Shared**: TypeScript, Winston (logging) - **Development**: Yarn Workspaces, ESLint, Prettier ## Features - πŸ“Š **Real-time Dashboard** - Monitor token activity at a glance - πŸͺ™ **Token Management** - Track discovered tokens and their metadata - πŸ•ΈοΈ **Graph Visualization** - Visualize connection graphs for developer relationships - πŸ“ **Event Streaming** - Real-time events from the Rust backend via Redis - πŸŒ™ **Dark/Light Theme** - Modern UI with theme switching - πŸ”” **Notifications** - Real-time notifications for important events ## Prerequisites - Node.js 16+ - Yarn (recommended) - Redis server running on localhost:6379 - Rust backend (`muhafidh`) running and publishing events ## Installation 1. **Clone and install dependencies**: ```bash cd ziya yarn install ``` 2. **Build shared module**: ```bash yarn workspace @ziya/shared build ``` ## Development ### Start Development Server ```bash # Start both frontend and backend in development mode yarn dev ``` This will: - Start the React frontend on `http://localhost:5173` - Start the Electron backend in development mode - Enable hot reload for both frontend and backend ### Individual Package Commands ```bash # Frontend only yarn workspace @ziya/frontend start # Backend only yarn workspace @ziya/backend dev # Shared module yarn workspace @ziya/shared dev ``` ## Production Build ```bash # Build all packages yarn build # Package the Electron app yarn package ``` ## Event Integration The application listens for these Redis events from the `muhafidh` Rust backend: ### `token_cex_updated` ```json { "mint": "string", "name": "string", "uri": "string", "dev_name": "string", "cex_name": "string", "cex_address": "string", "cex_updated_at": "string", "node_count": "number", "edge_count": "number", "graph": { "nodes": [...], "edges": [...] } } ``` ### `max_depth_reached` ```json { "mint": "string", "name": "string", "uri": "string", "bonding_curve": "string", "updated_at": "string", "node_count": "number", "edge_count": "number", "graph": { "nodes": [...], "edges": [...] } } ``` ## Configuration ### Redis Configuration Set environment variables: ```bash REDIS_HOST=localhost REDIS_PORT=6379 ``` ### Electron Configuration The app uses secure defaults: - Context isolation enabled - Node integration disabled - Preload script for secure IPC ## Project Structure ``` ziya/ β”œβ”€β”€ packages/ β”‚ β”œβ”€β”€ shared/ # Shared types and utilities β”‚ β”‚ β”œβ”€β”€ src/ β”‚ β”‚ β”‚ β”œβ”€β”€ types/ # TypeScript interfaces β”‚ β”‚ β”‚ └── utils/ # Shared utilities β”‚ β”‚ └── package.json β”‚ β”œβ”€β”€ frontend/ # React frontend β”‚ β”‚ β”œβ”€β”€ src/ β”‚ β”‚ β”‚ β”œβ”€β”€ components/ # React components β”‚ β”‚ β”‚ β”œβ”€β”€ pages/ # Page components β”‚ β”‚ β”‚ β”œβ”€β”€ store/ # Redux store and slices β”‚ β”‚ β”‚ β”œβ”€β”€ services/ # Frontend services β”‚ β”‚ β”‚ └── styles/ # Styled components β”‚ β”‚ └── package.json β”‚ └── backend/ # Electron backend β”‚ β”œβ”€β”€ src/ β”‚ β”‚ β”œβ”€β”€ services/ # Backend services β”‚ β”‚ β”œβ”€β”€ main.ts # Electron main process β”‚ β”‚ └── preload.ts # Preload script β”‚ └── package.json β”œβ”€β”€ package.json # Root workspace config └── README.md ``` ## Scripts - `yarn dev` - Start development servers - `yarn build` - Build all packages - `yarn start` - Start production app - `yarn package` - Package Electron app - `yarn clean` - Clean all build artifacts - `yarn lint` - Run linters - `yarn test` - Run tests ## Security - Electron app uses context isolation and disables node integration - IPC communication uses secure preload scripts - Redis connections use proper error handling and reconnection logic ## Contributing 1. Fork the repository 2. Create a feature branch 3. Make your changes 4. Run tests and linting 5. Submit a pull request ## License MIT License - see LICENSE file for details.