196 lines
No EOL
4.8 KiB
Markdown
196 lines
No EOL
4.8 KiB
Markdown
# 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. |