ChainPulse is a real-time blockchain event notification and visualization system that integrates smart account functionality (ERC-4337), event indexing (Envio), real-time notifications (WebSocket), an
# ChainPulse - Real-time Blockchain Event Notification & Visualization System
## ๐ Project Overview
**ChainPulse** is a comprehensive Web3 platform that provides real-time blockchain event monitoring, smart account integration, and data visualization. The system combines event indexing, instant notifications, and interactive dashboards to deliver seamless blockchain interaction experiences.
### ๐ฏ Core Value Proposition
- **Real-time Monitoring**: Instant notifications for on-chain events (transfers, swaps, NFT mints, etc.)
- **Smart Account Integration**: ERC-4337 Account Abstraction with automated response capabilities
- **Comprehensive Visualization**: Dynamic charts and dashboards for blockchain activity analysis
- **Multi-channel Notifications**: Web, Telegram, and Discord integration
- **Extensible Architecture**: Support for multiple chains and event types
---
## ๐๏ธ System Architecture
### Technology Stack
#### Frontend
- **Framework**: Next.js 15.2.4 with App Router
- **Language**: TypeScript 5.x
- **Styling**: Tailwind CSS 4.1.9 with custom animations
- **UI Components**: Shadcn/UI (50+ components) + Radix UI
- **Web3**: Wagmi + Viem + RainbowKit for wallet integration
- **Charts**: Recharts for data visualization
- **Real-time**: Socket.IO client for WebSocket connections
#### Backend
- **Runtime**: Node.js with Express.js
- **Language**: TypeScript
- **Database**: PostgreSQL with Prisma ORM
- **Authentication**: JWT with wallet signature verification
- **Real-time**: Socket.IO server for WebSocket communication
- **GraphQL**: Apollo Server for data queries
- **Rate Limiting**: Express-rate-limit for API protection
#### Blockchain & Indexing
- **Smart Contracts**: Solidity with ERC-4337 Account Abstraction
- **Indexer**: Envio for real-time event indexing
- **Networks**: Ethereum, Polygon, Arbitrum, Optimism, Base, Monad Testnet
- **Development**: Hardhat framework with comprehensive testing
#### Infrastructure
- **Database**: PostgreSQL (Local/Supabase)
- **Deployment**: Docker containerization ready
- **Monitoring**: Winston logging with structured logs
---
## โ
Completed Features
### ๐จ Frontend (100% Complete)
- โ
**Complete UI/UX Design**: Modern glass-morphism design with dark/light themes
- โ
**Wallet Integration**: RainbowKit with multi-wallet support
- โ
**Authentication Flow**: Signature-based login with persistent sessions
- โ
**Dashboard Components**:
- Smart Account Status panel
- Event Subscriptions management
- Notification center with filtering
- Real-time activity feed
- Analytics charts (4 types)
- โ
**Responsive Design**: Mobile-first approach with adaptive layouts
- โ
**Internationalization**: English/Chinese language support
- โ
**Animation System**: Framer Motion with smooth transitions
- โ
**50+ UI Components**: Complete Shadcn/UI integration
### ๐ง Backend (95% Complete)
- โ
**RESTful API**: 52 endpoints across 7 modules
- Authentication (3 endpoints)
- User Management (4 endpoints)
- Smart Accounts (8 endpoints)
- Event Subscriptions (7 endpoints)
- Notifications (6 endpoints)
- Analytics (12 endpoints)
- Automation Rules (6 endpoints)
- Integrations (6 endpoints)
- โ
**WebSocket Server**: Real-time event broadcasting
- โ
**Database Schema**: 10 tables with proper relationships
- โ
**Authentication System**: JWT + wallet signature verification
- โ
**Rate Limiting**: API protection with configurable limits
- โ
**Error Handling**: Comprehensive error management
- โ
**Logging System**: Structured logging with Winston
- โ
**Data Validation**: Zod schemas for all endpoints
### ๐๏ธ Database (100% Complete)
- โ
**Schema Design**: Complete ERD with 10 tables
- โ
**Relationships**: Proper foreign keys and constraints
- โ
**Indexing**: Optimized queries with strategic indexes
- โ
**Partitioning**: Monthly partitioning for large tables
- โ
**Security**: Row Level Security (RLS) policies
- โ
**Seed Data**: Comprehensive mock data for testing
- โ
**Migration Scripts**: Prisma-based database migrations
### ๐ Smart Contracts (90% Complete)
- โ
**ERC-4337 Implementation**: SimpleAccount with factory pattern
- โ
**Account Abstraction**: Gas abstraction and batch transactions
- โ
**Security Features**: Multi-signature and social recovery
- โ
**Testing Suite**: Comprehensive Hardhat tests
- โ
**Deployment Scripts**: Automated deployment with verification
- โ
**Gas Optimization**: Efficient contract design
### ๐ Event Indexing (90% Complete)
- โ
**Envio Configuration**: Complete schema and event handlers
- โ
**GraphQL Schema**: Structured data queries
- โ
**Event Processing**: Real-time blockchain event capture
- โ
**Multi-chain Support**: Configuration for 6+ networks
- โ
**Data Aggregation**: Event statistics and analytics
### ๐ Integration (85% Complete)
- โ
**Frontend-Backend**: Complete API integration
- โ
**Authentication Flow**: Wallet connection and session management
- โ
**Real-time Updates**: WebSocket event streaming
- โ
**Mock Data System**: Comprehensive test data generation
- โ
**Development Tools**: Prisma Studio, API documentation
---
## ๐ง Pending Features
### ๐ Deployment (0% Complete)
- โฌ **Smart Contract Deployment**: Deploy to testnets and mainnet
- โฌ **Envio Cloud Deployment**: Production indexer deployment
- โฌ **Frontend Deployment**: Vercel/Netlify hosting
- โฌ **Backend Deployment**: Railway/Heroku hosting
- โฌ **Database Hosting**: Production PostgreSQL setup
### ๐ง Advanced Features (20% Complete)
- โฌ **Automation Engine**: Smart contract interaction automation
- โฌ **Advanced Analytics**: Complex data aggregation and insights
- โฌ **Multi-chain Expansion**: Additional blockchain networks
- โฌ **Mobile App**: React Native mobile application
- โฌ **API Rate Plans**: Tiered access with usage limits
### ๐ Third-party Integrations (30% Complete)
- โฌ **Telegram Bot**: Automated notification bot
- โฌ **Discord Webhook**: Server notification integration
- โฌ **Email Notifications**: SMTP-based email alerts
- โฌ **Slack Integration**: Workspace notification system
### ๐งช Testing & Quality (60% Complete)
- โ
**Unit Tests**: Backend service layer testing
- โ
**Smart Contract Tests**: Comprehensive Hardhat test suite
- โฌ **Integration Tests**: End-to-end API testing
- โฌ **Frontend Tests**: React component testing
- โฌ **Performance Tests**: Load testing and optimization
---
## ๐ Development Progress
```
Overall Progress: โโโโโโโโโโโโโโโโโโโโโ 85%
Frontend: โโโโโโโโโโโโโโโโโโโโ 100% โ
Backend: โโโโโโโโโโโโโโโโโโโโ 95% โ
Database: โโโโโโโโโโโโโโโโโโโโ 100% โ
Smart Contracts: โโโโโโโโโโโโโโโโโโโโ 90% โ
Event Indexing: โโโโโโโโโโโโโโโโโโโโ 90% โ
Integration: โโโโโโโโโโโโโโโโโโโโ 85% โ
Deployment: โโโโโโโโโโโโโโโโโโโโ 0% โฌ
Testing: โโโโโโโโโโโโโโโโโโโโ 60% ๐
```
### Key Achievements
- **52 REST API endpoints** implemented and tested
- **50+ UI components** with modern design system
- **Complete database schema** with 10 tables and relationships
- **ERC-4337 smart contracts** with factory pattern
- **Real-time WebSocket** communication system
- **Comprehensive mock data** for development and testing
- **Multi-language support** (English/Chinese)
- **Responsive design** for all screen sizes
---
## ๐ Quick Start
### Prerequisites
- Node.js 20+
- PostgreSQL 14+
- Git
### Installation
```bash
# Clone repository
git clone https://github.com/gerrardLT/ChainPulse.git
cd ChainPulse
# Install dependencies
npm install
# Setup database
cd backend
npm run prisma:migrate
npm run db:seed
# Start development servers
npm run dev # Backend (port 4000)
# In new terminal
cd frontend
npm run dev # Frontend (port 3000)
```
---
## ๐ Project Structure
```
ChainPulse/
โโโ frontend/ # Next.js application
โ โโโ app/ # App Router pages
โ โโโ components/ # React components
โ โโโ hooks/ # Custom React hooks
โ โโโ lib/ # Utilities and API clients
โ โโโ public/ # Static assets
โโโ backend/ # Node.js API server
โ โโโ src/ # Source code
โ โโโ prisma/ # Database schema and migrations
โ โโโ tests/ # Test suites
โโโ contracts/ # Smart contracts
โ โโโ contracts/ # Solidity contracts
โ โโโ scripts/ # Deployment scripts
โ โโโ test/ # Contract tests
โโโ indexer/ # Envio indexer
โ โโโ config.yaml # Indexer configuration
โ โโโ schema.graphql # GraphQL schema
โ โโโ src/ # Event handlers
โโโ database/ # SQL scripts
โโโ docs/ # Documentation
```
---
## ๐ฏ Next Steps
### Immediate Priorities (Next 2 weeks)
1. **Smart Contract Deployment**: Deploy to Monad Testnet and Ethereum Sepolia
2. **Envio Indexer Deployment**: Set up production event indexing
3. **Integration Testing**: End-to-end functionality verification
4. **Performance Optimization**: Database query optimization and caching
### Medium-term Goals (1-2 months)
1. **Production Deployment**: Full system deployment to cloud platforms
2. **Advanced Analytics**: Complex data visualization and insights
3. **Mobile Application**: React Native app development
4. **Third-party Integrations**: Telegram and Discord bots
### Long-term Vision (3-6 months)
1. **Multi-chain Expansion**: Support for additional blockchain networks
2. **Enterprise Features**: Advanced automation and workflow management
3. **API Monetization**: Tiered access plans and usage-based pricing
4. **Community Features**: User-generated content and social features
---
### Development Guidelines
- **Code Quality**: TypeScript strict mode, ESLint, Prettier
- **Testing**: Unit tests for all business logic
- **Documentation**: Comprehensive inline and external documentation
- **Git Workflow**: Feature branches with detailed commit messages
### Key Documentation
- [Product Requirements](docs/ไบงๅ้ๆฑๆๆกฃ.md)
- [Technical Architecture](docs/็ณป็ปๆๆฏๆถๆ.md)
- [Database Design](docs/ๆฐๆฎๅบ่ฎพ่ฎก.md)
- [API Documentation](docs/API่ฎพ่ฎก.md)
- [Development Tasks](docs/ๅผๅไปปๅกๆธ
ๅ.md)
---
## ๐ License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
---
- **Real-time Monitoring**: Instant notifications for on-chain events (transfers, swaps, NFT mints, etc.) - **Smart Account Integration**: ERC-4337 Account Abstraction with automated response capabilities - **Comprehensive Visualization**: Dynamic charts and dashboards for blockchain activity analysis - **Multi-channel Notifications**: Web, Telegram, and Discord integration - **Extensible Architecture**: Support for multiple chains and event types