Event-driven notification system for DAO governance with real-time proposal monitoring and multi-channel delivery. Built with microservices architecture and RabbitMQ message queues.
The system consists of four main microservices that work together to provide scalable, reliable notification delivery:
1. Logic System
Trigger Engine - Monitors blockchain data and initiates notifications
- Data Monitoring: Polls AntiCapture GraphQL API for new proposals
- Business Logic: Applies filtering rules based on proposal status
2. Dispatcher
Message Orchestrator - Processes events and coordinates notification delivery
- Event Routing: Routes trigger events to appropriate handlers
- Subscription Management: Fetches subscriber lists with temporal filtering
- Notification Creation: Builds formatted notifications for each user
API Gateway - Manages user preferences and subscription data
- REST API: Subscription CRUD operations with Swagger documentation
- Deduplication: Prevents duplicate notifications via tracking
- User Management: Multi-channel user profiles and preferences
Delivery Layer - Handles notification delivery and user interactions
- Telegram Bot: Interactive bot for preference management
- Message Delivery: RabbitMQ consumer for notification distribution
- Node.js 18+ with pnpm
- Docker and Docker Compose
- PostgreSQL database
- RabbitMQ message broker
- Telegram Bot Token (from @BotFather)
- Clone and Install
git clone <repository-url>
cd notificationSystem
pnpm install- Environment Configuration
cp env.example .env
# Edit .env with your configuration- Start Services
# Start all services with Docker Compose
pnpm dev1. Logic System polls AntiCapture API for new proposals
2. Logic System sends trigger events to Dispatcher via RabbitMQ
3. Dispatcher processes events and fetches DAO subscribers
4. Dispatcher creates individual notifications and publishes to Consumer queue
5. Consumer delivers notifications to users via Telegram
6. Consumer tracks successful deliveries in Subscription Server
1. User interacts with Telegram bot (/start, /daos)
2. Consumer fetches available DAOs from AntiCapture API
3. Consumer presents interactive selection interface
4. User selections are sent to Subscription Server
5. Preferences are stored in PostgreSQL database
6. Future notifications are filtered by these preferences
- Deduplication: Prevents duplicate notifications via tracking
- Temporal Filtering: Only notifies users subscribed before events
- Session Management: Persistent user state during interactions
- Trigger System: Easy to add new event types and business logic
- Multi-Channel: Framework for adding Discord, Slack, etc.
notificationSystem/
├── apps/
│ ├── logic-system/ # Event monitoring and triggering
│ ├── dispatcher/ # Message processing and routing
│ ├── subscription-server/ # User preference management
│ ├── consumers/ # Notification delivery (Telegram)
│ └── integrated-tests/ # End-to-end testing
├── packages/
│ ├── anticapture-client/ # GraphQL client for DAO data
│ └── rabbitmq-client/ # Shared RabbitMQ utilities
├── docker-compose.yml # Multi-service orchestration
└── pnpm-workspace.yaml # Monorepo configuration
- Logic System Documentation - Trigger engine and monitoring
- Dispatcher Documentation - Message processing hub
- Subscription Server Documentation - REST API and preferences
- Consumer Documentation - Telegram bot and delivery
- Adding New Trigger Types - Extend monitoring capabilities
