A high-performance scalable backend service for indexing Solana blockchain events, processing webhooks, and managing job subscriptions. This service uses BullMQ with Redis for efficient asynchronous processing and Redis caching for optimized performance. It uses Helius webhooks to recieve updates for latest blockchain events.
- Webhook Processing: Handle NFT mint, sale, listing, and other Solana blockchain events
- Job Subscription Management: Create and manage webhook subscription jobs
- Queue-based Architecture: Leverages BullMQ for reliable asynchronous processing
- Redis Caching: Optimizes job lookups with intelligent caching
- Horizontal Scaling: Designed to scale across multiple instances
- Node.js & TypeScript: Core runtime and language
- Express: Web framework
- BullMQ: Queue management for asynchronous processing
- Redis: For queue management and caching
- Supabase: Database and authentication
- Helius SDK: For interacting with Solana blockchain data
- Node.js (v16+)
- Redis server (local or cloud)
- Supabase account
- Helius API key
git clone https://github.com/bevatsal1122/solana-indexer-backend.git
cd solana-indexer-backend
npm install
Create a .env
file in the root directory using the provided .env.example
as a template:
cp .env.example .env
Update the .env
file with your actual credentials:
- Supabase URL and key
- Redis connection details
- Helius API key
- Other configuration options
The application requires Redis for BullMQ and caching. You can:
-
Use a local Redis instance:
# Install Redis (MacOS) brew install redis # Start Redis server brew services start redis
-
Install Docker:
Download the docker.dmg file from their official website and install it locally.
-
Run this command:
npm run start:redis
- Run this command:
npm run dev
- Call GET:
http://localhost:4000/webhooks/create
- GET /health: Check service health status
- GET /api/jobs: List all job subscriptions
- POST /api/jobs: Create a new job subscription
- PUT /api/jobs/:id: Update a job subscription
- DELETE /api/jobs/:id: Delete a job subscription
- POST /api/webhooks/log: Process webhooks from Helius
BullMQ is used for asynchronous webhook processing. When enabled:
- Incoming webhooks are added to appropriate queues
- Worker processes handle these jobs independently
- Failed jobs are automatically retried with backoff
To disable BullMQ and use synchronous processing, set ENABLE_BULL_MQ=false
in your .env
.
For more details, see README-BULLMQ.md.
Redis caching is used to optimize job subscription lookups:
- Active job subscriptions are cached by job type
- Cache has a configurable TTL (default: 1 hour)
- Cache is refreshed when jobs are accessed
- Cache is updated when job statuses change
Create a .env
file with the following variables:
PORT=4000
SUPABASE_URL=your_supabase_url
SUPABASE_ANON_KEY=your_supabase_anon_key
# Set to false to disable BullMQ and use synchronous processing
ENABLE_BULL_MQ=true
# Redis Configuration (for BullMQ and caching)
REDIS_URL=your_redis_url
REDIS_HOST=your_redis_host
REDIS_PORT=your_redis_port
REDIS_PASSWORD=your_redis_password
# Helius API Key for Solana data
HELIUS_API_KEY=your_helius_api_key
# Webhook Authentication
WEBHOOK_AUTHORIZATION=your_webhook_auth_token