A scalable, enterprise-grade notification system built with .NET 8, designed for modern applications requiring reliable message delivery across multiple communication channels.
This notification engine provides a robust, microservices-based architecture for handling multi-channel notifications at scale. Built with clean architecture principles, it offers asynchronous processing, automatic retry mechanisms, and comprehensive monitoring capabilities.
- Email - SendGrid integration with HTML and plain text support
- SMS - Twilio integration with international support
- Push Notifications - Firebase Cloud Messaging integration
- Webhooks - Customizable HTTP callbacks
- RabbitMQ message queuing with MassTransit
- Specialized workers per channel for independent scaling
- Automatic retry with exponential backoff
- Dead letter queue handling for failed messages
- Message prioritization (High, Medium, Low)
- Liquid.NET templating engine for flexible content
- HTML and text support for emails
- Automatic validation of required variables
- Complete CRUD operations via REST API
- Quartz.NET for distributed job scheduling
- Precise minute-level scheduling accuracy
- Automatic reprocessing of failed notifications
- Real-time job monitoring
- Structured logging with Serilog
- Detailed metrics by channel and status
- Health checks for all services
- Real-time statistics dashboard
The system follows a clean architecture pattern with clear separation of concerns:
API Gateway → RabbitMQ → Specialized Workers → External Providers
↓
MongoDB (Templates & Logs)
↓
Quartz Scheduler
- Docker and Docker Compose
- .NET 8 SDK (for local development)
- Clone the repository
git clone https://github.com/ArthurDS-tech/Notification-Engine.git
cd Notification-Engine- Configure environment variables
cp .env.example .env
# Edit .env with your provider credentials- Start the services
# Windows
start.bat
# Linux/Mac
chmod +x start.sh && ./start.sh
# Or manually
docker-compose up -d- Verify installation
# Check service health
curl http://localhost:5000/health
# Send test notification
curl -X POST http://localhost:5000/api/notifications \
-H "Content-Type: application/json" \
-d '{
"recipient": "user@example.com",
"channel": "Email",
"templateId": "welcome-email",
"variables": {"userName": "John Doe"},
"priority": "High"
}'src/
├── NotificationEngine.Domain/ # Core entities and interfaces
├── NotificationEngine.Application/ # Business logic and CQRS handlers
├── NotificationEngine.Infrastructure/ # External service implementations
├── NotificationEngine.Workers/ # Background processing services
├── NotificationEngine.DashboardApi/ # REST API for management
└── NotificationEngine.Tests/ # Unit and integration tests
The system requires the following environment variables (see .env.example):
# Database
MONGODB_CONNECTION_STRING=mongodb://admin:password123@mongodb:27017/notifications?authSource=admin
# Message Queue
RABBITMQ_CONNECTION_STRING=amqp://guest:guest@rabbitmq:5672/
# Email Provider (SendGrid)
SENDGRID_API_KEY=your-sendgrid-api-key
# SMS Provider (Twilio)
TWILIO_ACCOUNT_SID=your-twilio-account-sid
TWILIO_AUTH_TOKEN=your-twilio-auth-token
# Push Notifications (Firebase)
FIREBASE_PROJECT_ID=your-firebase-project-id
# Worker Configuration
WORKER_TYPE=All # Options: All, Email, SMS, Push, Webhook, or combinations like "Email,SMS"Templates are stored in MongoDB and managed via the REST API. Example template structure:
{
"id": "welcome-email",
"name": "Welcome Email Template",
"channel": "Email",
"subject": "Welcome to {{ companyName }}, {{ userName }}!",
"body": "Hello {{ userName }}, welcome to {{ companyName }}!",
"htmlBody": "<h1>Welcome, {{ userName }}!</h1><p>Welcome to <strong>{{ companyName }}</strong>!</p>",
"requiredVariables": ["userName", "companyName"]
}| Method | Endpoint | Description |
|---|---|---|
POST |
/api/notifications |
Send new notification |
GET |
/api/notifications/{id} |
Get notification by ID |
GET |
/api/notifications/pending |
List pending notifications |
GET |
/api/notifications/stats |
Get delivery statistics |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/templates |
List all templates |
GET |
/api/templates/{id} |
Get template by ID |
POST |
/api/templates |
Create new template |
PUT |
/api/templates/{id} |
Update existing template |
DELETE |
/api/templates/{id} |
Delete template |
- API Documentation: http://localhost:5000/swagger
- Health Checks: http://localhost:5000/health
- Statistics: http://localhost:5000/api/notifications/stats
- RabbitMQ Management: http://localhost:15672 (guest/guest)
- Throughput per channel (messages/minute)
- Success/failure rates per provider
- Average processing latency
- Queue depths and backlogs
- Worker and job status
- Start infrastructure services
docker-compose up -d mongodb rabbitmq- Run the API
cd src/NotificationEngine.DashboardApi
dotnet run --urls="http://localhost:5000"- Run workers
cd src/NotificationEngine.Workers
dotnet run# Run all tests
dotnet test
# Run with coverage
dotnet test --collect:"XPlat Code Coverage"
# Run integration tests
dotnet test --filter Category=IntegrationThe system supports horizontal scaling of individual workers:
# Scale workers independently based on load
services:
email-worker:
deploy:
replicas: 3 # Scale for high email volume
sms-worker:
deploy:
replicas: 1 # Limited by provider rate limits| Channel | Retry Policy | Timeout | Dead Letter Queue |
|---|---|---|---|
| 3x exponential | 30s | Yes | |
| SMS | 2x exponential | 60s | Yes |
| Push | 3x exponential | 30s | Yes |
| Webhook | 5x exponential | 120s | Yes |
Workers not processing messages
# Check worker logs
docker-compose logs -f email-worker
# Check RabbitMQ queues
curl -u guest:guest http://localhost:15672/api/queuesMongoDB connection issues
# Test MongoDB connection
docker exec -it notification-mongo mongosh -u admin -p password123Template rendering problems
# Check templates in database
docker exec -it notification-mongo mongosh -u admin -p password123
use notifications
db.templates.find().pretty()We welcome contributions to improve the Notification Engine. Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-feature) - Commit your changes (
git commit -am 'Add new feature') - Push to the branch (
git push origin feature/new-feature) - Create a Pull Request
- Follow clean architecture principles
- Write comprehensive tests for new features
- Update documentation for API changes
- Ensure all tests pass before submitting PR
This project is licensed under the MIT License - see the LICENSE file for details.
For questions, issues, or contributions, please:
- Open an issue on GitHub
- Check the documentation in the
/docsfolder - Review the implementation summary in
IMPLEMENTATION_SUMMARY.md
Developed by Arthur DS - A production-ready notification system for modern applications.