4.4 KiB
🎯 START HERE - TAT Notifications Setup
What You Need to Do RIGHT NOW
⚡ 2-Minute Setup (Upstash Redis)
-
Open this link: https://console.upstash.com/
- Sign up with GitHub/Google (it's free)
-
Create Redis Database:
- Click "Create Database"
- Name:
redis-tat-dev - Type: Regional
- Region: Pick closest to you
- Click "Create"
-
Copy the Redis URL:
- You'll see:
rediss://default:AbC123xyz...@us1-mighty-12345.upstash.io:6379 - Click the copy button 📋
- You'll see:
-
Open
Re_Backend/.envand add:REDIS_URL=rediss://default:AbC123xyz...@us1-mighty-12345.upstash.io:6379 TAT_TEST_MODE=true -
Restart Backend:
cd Re_Backend npm run dev -
Look for this in the logs:
✅ [TAT Queue] Connected to Redis ✅ [TAT Worker] Initialized and listening ⏰ TAT Configuration: - Test Mode: ENABLED (1 hour = 1 minute)
✅ DONE! You're ready to test!
Test It Now (6 Minutes)
- Create a workflow request via your frontend
- Set TAT: 6 hours (will become 6 minutes in test mode)
- Submit the request
- Watch for notifications:
- 3 minutes: ⏳ 50% notification
- 4.5 minutes: ⚠️ 75% warning
- 6 minutes: ⏰ 100% breach
Verify It's Working
Check Backend Logs:
# You should see:
[TAT Scheduler] Calculating TAT milestones...
[TAT Scheduler] ✅ TAT jobs scheduled
[TAT Processor] Processing tat50...
[TAT Processor] tat50 notification sent
Check Upstash Console:
- Go to https://console.upstash.com/
- Click your database
- Click "CLI" tab
- Type:
KEYS bull:tatQueue:* - Should see your scheduled jobs
Check Database:
SELECT
approver_name,
tat50_alert_sent,
tat75_alert_sent,
tat_breached,
status
FROM approval_levels
WHERE status = 'IN_PROGRESS';
What Test Mode Does
Normal Mode: Test Mode:
48 hours → 48 minutes
24 hours → 24 minutes
6 hours → 6 minutes
2 hours → 2 minutes
✅ Perfect for quick testing!
✅ Turn off for production: TAT_TEST_MODE=false
Troubleshooting
❌ "ECONNREFUSED" Error?
Fix:
- Check your
.envfile hasREDIS_URL=rediss://... - Verify the URL is correct (copy from Upstash again)
- Make sure it starts with
rediss://(double 's') - Restart backend:
npm run dev
❌ No Logs About Redis?
Fix:
- Check
.envfile exists inRe_Backend/folder - Make sure you restarted the backend
- Look for any errors in console
❌ Jobs Not Running?
Fix:
- Verify
TAT_TEST_MODE=truein.env - Make sure request is SUBMITTED (not just created)
- Check Upstash Console → Metrics (see if commands are running)
Next Steps
Once you see the first notification working:
- ✅ Test multi-level approvals
- ✅ Test early approval (jobs should cancel)
- ✅ Test rejection flow
- ✅ Check activity logs
- ✅ Verify database flags
Documentation
- Quick Start:
TAT_QUICK_START.md - Upstash Guide:
docs/UPSTASH_SETUP_GUIDE.md - Full System Docs:
docs/TAT_NOTIFICATION_SYSTEM.md - Testing Guide:
docs/TAT_TESTING_GUIDE.md - Quick Reference:
UPSTASH_QUICK_REFERENCE.md
Why Upstash?
✅ No installation (works on Windows immediately)
✅ 100% free for development
✅ Same setup for production
✅ No maintenance required
✅ Fast (global CDN)
✅ Secure (TLS by default)
Production Deployment
When ready for production:
-
Keep using Upstash OR install Redis on Linux server:
sudo apt install redis-server -y -
Update
.envon server:REDIS_URL=redis://localhost:6379 # or keep Upstash URL TAT_TEST_MODE=false # Use real hours -
Deploy and monitor!
Need Help?
Upstash Console: https://console.upstash.com/
Our Docs: See docs/ folder
Redis Commands: Use Upstash Console CLI tab
Status Checklist
- Upstash account created
- Redis database created
- REDIS_URL copied to
.env - TAT_TEST_MODE=true set
- Backend restarted
- Logs show "Connected to Redis"
- Test request created and submitted
- First notification received
✅ All done? Congratulations! 🎉
Your TAT notification system is now LIVE!
Last Updated: November 4, 2025
Team: Royal Enfield Workflow