92 lines
3.5 KiB
Markdown
92 lines
3.5 KiB
Markdown
# 📢 Distributed Notification and Alert System
|
||
|
||
## 📌 Overview
|
||
|
||
This project is a **distributed backend system** designed to process and deliver notifications across multiple channels (Email, SMS, Push). It supports **real-time alerts, scheduled notifications, user preference handling, and query-driven delivery logic**. The system is built for scalability, resilience, and extensibility, leveraging **Node.js, Kafka, MongoDB, and Dockerized microservices**.
|
||
|
||
---
|
||
|
||
## 🎯 Key Features
|
||
|
||
- **Real‑Time & Scheduled Delivery**: Immediate processing for urgent alerts, scheduled pipelines for deferred notifications.
|
||
- **User Preferences**: Configurable quiet hours, channel selection, and throttling limits.
|
||
- **Advanced Query Logic**:
|
||
- [Throttling](ca://s?q=Notification_throttling) to enforce per‑user limits.
|
||
- [Quiet Hours Filtering](ca://s?q=Quiet_hours_notification_filtering).
|
||
- [Deduplication](ca://s?q=Notification_deduplication) of similar alerts.
|
||
- [Aggregation](ca://s?q=Notification_aggregation) of low‑priority notifications.
|
||
- [Priority‑Based Delivery](ca://s?q=Priority_based_notification_delivery).
|
||
- **Resilient Messaging**: Kafka decouples ingestion, processing, and delivery for fault tolerance.
|
||
- **Retry & Logging**: Failed deliveries retried with logging into MongoDB.
|
||
- **Analytics API**: `/analytics` endpoint for delivery stats, retries, and engagement metrics.
|
||
|
||
---
|
||
|
||
## 🎯 Objectives
|
||
|
||
- Ingest and validate notification requests via APIs.
|
||
- Process notifications in real-time or schedule them for future delivery.
|
||
- Respect **user preferences** (quiet hours, channel selection, throttling limits).
|
||
- Support **deduplication, aggregation, and prioritization** of alerts.
|
||
- Deliver notifications reliably with retry logic and logging.
|
||
- Provide analytics and monitoring endpoints for system visibility.
|
||
|
||
---
|
||
|
||
## ⚙️ Implementation Details
|
||
|
||
- **Backend Framework**: Node.js, Express.js
|
||
- **Messaging System**: Apache Kafka
|
||
- **Database**: MongoDB (notifications, preferences, analytics)
|
||
- **Job Scheduling**: node-schedule
|
||
- **ORM**: Mongoose
|
||
- **Containerization**: Docker + Docker Compose
|
||
|
||
---
|
||
|
||
## 🏗️ System Components
|
||
|
||
1. **Notification Ingestion & Validation Service**
|
||
- `/notify` API endpoint to receive requests.
|
||
- Validates payload and publishes to Kafka topic `notifications`.
|
||
|
||
2. **Notification Processing & Scheduling Engine**
|
||
- Real-time delivery for urgent/high-priority alerts.
|
||
- Scheduled notifications stored in MongoDB and checked periodically.
|
||
|
||
3. **User Preferences & Rules**
|
||
- Preferred channels (Email, SMS, Push).
|
||
- Quiet hours (Do Not Disturb).
|
||
- Notification limits (e.g., max 3/hour).
|
||
|
||
4. **Query Logic**
|
||
- **Throttling**: Restrict notifications per user-defined limits.
|
||
- **Quiet Hours Filtering**: Reschedule notifications outside quiet hours.
|
||
- **Deduplication**: Suppress duplicate alerts within a time window.
|
||
- **Aggregation**: Batch low-priority notifications into summaries.
|
||
- **Urgent Alerts**: Immediate bypass of scheduling.
|
||
|
||
5. **Notification Delivery Service**
|
||
- Channels: Email, SMS, Push (mock integrations).
|
||
- Retry mechanism for failed deliveries.
|
||
- Logging of statuses in MongoDB.
|
||
|
||
6. **Analytics & Monitoring**
|
||
- `/analytics` endpoint for delivery stats, retries, and engagement metrics.
|
||
|
||
---
|
||
|
||
## 🛠️ Installation & Setup
|
||
|
||
```bash
|
||
# Clone the repository
|
||
git clone https://github.com/akshay931/distri_notification_and_alert_system.git
|
||
cd distri_notification_and_alert_system
|
||
|
||
# Install dependencies
|
||
npm install
|
||
|
||
# Start services with Docker Compose
|
||
docker-compose up -d
|
||
```
|