A production-grade notification decision engine that solves alert fatigue, message duplication, and time-sensitivity — with full explainability, user authentication, and a live dashboard UI.
- Authentication System: Secure signup/login with session cookies, password toggle, balloon animation on signup, and user avatar on dashboard.
- Decision Pipeline: 7-stage evaluation per event — Expiry → Dedupe → Near-Dedupe → Critical Priority → Fatigue → AI Score → Rule Engine.
- Explainability Layer: Every decision returns a full "Decision Trace" showing exactly why a notification was sent, deferred (
LATER), or suppressed (NEVER). - AI-Native Deduplication: Simulated semantic similarity to block near-duplicate spam (ready for FAISS/LLM upgrade).
- Intelligent Fatigue Control: Max 5 notifications/hr per user, 2-min cooldown, with critical priority override.
- Hot-Swappable Rules: Versioned business rules updated live via API — no redeployment needed.
- Observability: Real-time metrics on latency, dedupe rates, and decision breakdown.
- Zero-SQL: Fully in-memory — no database dependencies, instant startup.
See architecture.md for a full component breakdown.
| Layer | Technology |
|---|---|
| Framework | FastAPI (Python) |
| Server | Uvicorn (ASGI) |
| Validation | Pydantic |
| Auth | Session cookies (SHA-256 hashed passwords) |
| Storage | In-memory (Zero-SQL) |
| AI Scoring | Simulated (keyword-based, ready for LLM) |
| Deployment | Render (render.yaml included) |
# 1. Install dependencies
pip install -r requirements.txt
# 2. Run the engine
python -m app.main
# 3. Open in browser
# http://localhost:8000You'll be redirected to /login. Sign up first at /signup, then log in to access the dashboard.
| Route | Description |
|---|---|
/ |
Dashboard (protected — requires login) |
/login |
Login page with password toggle |
/signup |
Signup with balloon celebration & auto-login |
/docs |
Interactive Swagger API console |
/audit |
Live notification decision log |
/metrics |
System performance stats |
/logout |
Clears session and redirects to login |
| Method | Path | Description |
|---|---|---|
POST |
/api/signup |
Register + auto-login (session cookie set) |
POST |
/api/login |
Login (session cookie set) |
GET |
/logout |
Clear session |
| Method | Path | Description |
|---|---|---|
POST |
/notify |
Submit a notification event for decision |
POST |
/rules |
Create/update a triage rule |
GET |
/metrics |
Engine performance stats |
GET |
/audit |
Full notification decision log |
POST /notify
{
"user_id": "user_123",
"event_type": "transaction",
"message": "You received $100",
"priority_hint": "low",
"dedupe_key": "txn_abc_001"
}{
"decision": "NOW",
"reason": "Passed all checks",
"trace": ["Expiry check passed", "Exact duplicate check passed", "AI Score: 0.63", "Rule engine check passed"],
"latency_ms": 1.2,
"fallback_triggered": false
}If AI scoring or the rule engine throws an exception, the system falls back to a safe heuristic:
critical→ AlwaysNOWpromotion→LATER- All others →
NOW
A render.yaml is included. Set these fields on Render:
| Field | Value |
|---|---|
| Root Directory | notification_engine |
| Build Command | pip install -r requirements.txt |
| Start Command | uvicorn app.main:app --host 0.0.0.0 --port $PORT |
⚠️ Free tier: data resets on restart (in-memory only). First wake-up may take ~30s.
- Production Dedupe: Replace token-overlap with FAISS or pgvector embedding search.
- Persistent Storage: Migrate from in-memory to PostgreSQL (Render add-on available).
- Distributed Queue: Celery + Redis/Kafka for deferred notifications at scale.
- LLM Rule Engine: Accept natural-language rules translated to JSON via Gemini.