This project is a scalable Notification Service built using FastAPI. It supports sending notifications via multiple channels (Email, SMS, Push) with priority handling, retry mechanisms, and user preferences.
The system is designed to handle high throughput and reliability using asynchronous processing with a queue-based architecture.
- Backend Framework: FastAPI
- Language: Python
- Database: SQLite (for demo)
- ORM: SQLAlchemy
- Queue: In-memory Priority Queue
- Worker: Background thread
- Validation: Pydantic
- Send notifications via API
- Multi-channel support (Email, SMS, Push - structure ready)
- User preferences (opt-in / opt-out)
- Priority handling (critical, high, normal, low)
- Notification status tracking (basic)
- Asynchronous processing using queue
- Background worker for notification processing
- Retry mechanism (max 3 retries)
- Exponential backoff strategy
- Priority-based processing
POST /notifications→ Create notificationGET /notifications/{id}→ Get notification by IDGET /users/{user_id}/notifications→ Get user notifications
POST /users/{user_id}/preferences→ Set preferencesGET /users/{user_id}/preferences→ Get preferences
git clone <your-repo-link>
cd notification-servicepython -m venv venv
venv\Scripts\activatepython -m pip install -r requirements.txtpython -m uvicorn app.main:app --reloadSwagger UI:
http://127.0.0.1:8000/docs
POST /notifications
{
"user_id": "123",
"message": "Hello Harini",
"channels": ["email", "sms"],
"priority": "high"
}-
Retries failed notifications up to 3 times
-
Uses exponential backoff:
- 1st retry → 2 seconds
- 2nd retry → 4 seconds
- 3rd retry → 8 seconds
Client → API → Database → Queue → Worker → Notification Processing
- External services (Email/SMS) are mocked
- Authentication is not implemented
- SQLite used for simplicity (can be replaced with PostgreSQL)
- Integrate Redis/RabbitMQ
- Add real email/SMS providers
- Add authentication & authorization
- Add analytics dashboard
- Add webhook support
Harini Radhakrishnan