All Mighty Push - Enterprise Push Notification Library
A production-ready, enterprise-grade push notification system for Node.js. Built with TypeScript, featuring automatic retry logic, circuit breakers, and pluggable architecture. 230+ tests, 90% coverage.
View on GitHubThe Problem
Most push notification solutions require vendor lock-in (Firebase, OneSignal) or lack enterprise-grade reliability features. Developers need a self-hosted, fully customizable solution with production-ready reliability patterns built-in. This library provides exactly that—think of it as building your own Firebase Cloud Messaging alternative with full control over data and infrastructure.
Enterprise-Grade Features
Built with production reliability in mind, the library includes automatic retry logic with exponential backoff and jitter (±25%), circuit breaker pattern to prevent cascading failures, token bucket rate limiting, and a background worker for asynchronous retry queue processing. All with graceful shutdown and lifecycle hooks for complete observability.
System Architecture
The system follows a layered architecture with PushCore as the central orchestrator. Below it are pluggable adapters for storage (SQLite, PostgreSQL, MongoDB), push providers (Web Push), and reliability components (Circuit Breaker, Rate Limiter, Retry Worker). This design allows swapping implementations without changing core logic.
Key Components
- Storage Adapter - Pluggable database layer
- Provider Adapter - VAPID authentication & push services
- Circuit Breaker - Three-state failure prevention
- Rate Limiter - Token bucket algorithm
- Retry Worker - Background queue processing
Intelligent Retry Logic
Implements exponential backoff with jitter to avoid thundering herd problems. Starting with a 1-second base delay, each retry doubles the wait time (2x backoff factor) with ±25% randomization, capped at 1 hour. The system respects server Retry-After headers and automatically marks subscriptions as expired after max retries. This ensures reliable delivery without overwhelming downstream services.
Circuit Breaker Pattern
A three-state machine prevents cascading failures. In the Closed state, requests pass through normally. When failures exceed the threshold (default: 5), it opens and blocks requests for 60 seconds. After the timeout, it enters Half-Open state, allowing limited requests (default: 3) to test recovery before fully closing again.
Rate Limiting
Uses a token bucket algorithm for smooth rate limiting with burst capacity. Tokens refill automatically based on elapsed time, with configurable capacity and refill rate. Supports both blocking and non-blocking acquisition modes, preventing overwhelming of downstream push services while maintaining throughput.
Production-Ready Codebase
Built with TypeScript in strict mode across 7 modular packages in a monorepo. The codebase includes 3,500+ lines of implementation code, 230+ tests achieving ~90% coverage, and 2,500+ lines of documentation. Development took approximately 70 hours, with comprehensive testing using Jest and ts-jest. The modular design allows for easy extension and maintenance.
Package Breakdown
- push-core - 2,000+ lines, 128 tests (core engine)
- push-webpush - 200+ lines, 21 tests (Web Push provider)
- push-storage-sqlite - 400+ lines, 67 tests (SQLite adapter)
- push-storage-postgres - PostgreSQL adapter
- push-storage-mongo - MongoDB adapter
- push-express - Express middleware (REST API)
- push-cli - Command-line tools
Real-World Use Cases
- E-commerce - Order updates, delivery notifications
- Social Media - Messages, likes, comments
- News/Media - Breaking news, content alerts
- Productivity - Task reminders, calendar events
- IoT/Monitoring - System alerts, threshold breaches
Complete Demo Application
Includes a full test project demonstrating all features with a beautiful gradient UI for subscription management, Express REST API with all endpoints, service worker for client-side push handling, and background worker for retry queue processing. Automated setup scripts for Linux/Mac/Windows make it easy to get started. The comprehensive 500+ line setup guide walks through every step.
Watch the demo video on YouTube to see the system in action.
Performance Characteristics
- Throughput: 100-500 notifications/second
- Latency: <10ms per operation (excluding network)
- Memory: ~50MB base + ~1KB per operation
- Concurrency: Configurable (default: 10 concurrent)
Tech Stack
- TypeScript (strict mode) with Node.js 16+
- Jest testing framework (230+ tests)
- web-push for VAPID authentication
- better-sqlite3 for high-performance storage
- npm workspaces for monorepo management
Key Learnings & Technical Highlights
This project demonstrates SOLID principles through dependency inversion for pluggable adapters, design patterns including Strategy (adapters), Observer (hooks), and State (circuit breaker). The implementation showcases production patterns like reliability through circuit breakers and retry logic, observability via lifecycle hooks and metrics integration, scalability with stateless design and horizontal scaling, and maintainability through modular architecture and comprehensive testing.
The developer experience prioritizes simplicity with an intuitive API and sensible defaults, type safety with full autocomplete and compile-time checks, comprehensive documentation with inline comments and setup guides, and easy testing with mock adapters. The result is a production-grade infrastructure library that showcases professional software engineering practices suitable for real-world deployment.
Production Ready
The library is fully production-ready with support for PostgreSQL or MongoDB in production environments (SQLite for development), separate worker processes for retry queue handling, lifecycle hooks for metrics collection, horizontal scaling support through stateless design, and HTTPS with secure VAPID key storage. The system handles 100-500 notifications per second with sub-10ms latency and efficient memory usage.
Status: ✅ Production Ready | License: MIT | View on GitHub
