Your notification backend is ready! Here's what's set up:
backend/
├── server.js # Express server with FCM integration
├── package.json # Dependencies (Express, Firebase Admin SDK)
├── .env.example # Environment template
├── .gitignore # Security (prevents committing secrets)
├── README.md # Backend documentation
└── DEPLOYMENT_GUIDE.md # Complete deployment instructions
App Updated:
- ✅
AdminPriceFormScreen.tsx- Now calls backend API - ✅
.env- Backend URL added
- Go to Firebase Console: https://console.firebase.google.com/
- Select reshmeinfo project
- Click ⚙️ Settings → Project settings → Service accounts tab
- Click "Generate new private key" → Download JSON
- Save it securely!
-
Push backend to GitHub:
cd backend git init git add . git commit -m "Add notification backend" # Create repo on GitHub: reshmeinfo-backend git remote add origin https://github.com/YOUR_USERNAME/reshmeinfo-backend.git git push -u origin main
-
Deploy on Render:
- Go to https://render.com/ → Sign up/Login
- Click "New +" → "Web Service"
- Connect GitHub repo
- Configure:
- Name:
reshmeinfo-notifications - Build:
npm install - Start:
npm start - Plan: Free
- Name:
-
Add Environment Variables:
- Click "Advanced" → "Add Environment Variable"
- Add
FIREBASE_PROJECT_ID=reshmeinfo - Add
FIREBASE_SERVICE_ACCOUNT= (paste JSON from Step 1 - as one line, no spaces)
Example:
{"type":"service_account","project_id":"reshmeinfo","private_key_id":"abc123","private_key":"-----BEGIN PRIVATE KEY-----\nXXXXX\n-----END PRIVATE KEY-----\n","client_email":"firebase-adminsdk-xxx@reshmeinfo.iam.gserviceaccount.com",...} -
Deploy → Copy your live URL:
https://reshmeinfo-notifications.onrender.com
-
Update
.envwith deployed URL:# Replace localhost with your Render URL EXPO_PUBLIC_BACKEND_URL="https://reshmeinfo-notifications.onrender.com"
-
Build new APK:
eas build --platform android --profile production
-
Install & Test:
- Install new APK
- Admin updates price
- Users receive notifications! 🎉
curl https://reshmeinfo-notifications.onrender.com/Expected:
{"status":"ok","message":"ReshmeInfo Notification Server is running"}curl -X POST https://reshmeinfo-notifications.onrender.com/send-notification \
-H "Content-Type: application/json" \
-d '{"priceData":{"market":"Test","breed":"CB","minPrice":100,"maxPrice":200,"avgPrice":150}}'Expected:
{"success":true,"sent":2,"failed":0}- Open admin panel in app
- Update any price
- Save
- Check production users receive notification ✅
┌─────────────┐
│ Admin │
│ Updates │ 1. Save price to Firestore
│ Price │ ────────────────────────────┐
└─────────────┘ ▼
┌─────────────────┐
│ Firestore │
│ (Price saved) │
└─────────────────┘
│
│ 2. App calls backend
▼
┌──────────────────────────┐
│ Backend Server │
│ (Render/Railway) │
│ │
│ 1. Get FCM tokens │
│ 2. Send notifications │
│ 3. Clean invalid tokens │
└──────────────────────────┘
│
│ 3. FCM notifications
▼
┌──────────────────────────┐
│ Production Users │
│ (Receive alerts 🔔) │
└──────────────────────────┘
Render.com Free Tier:
- ✅ 750 hours/month
- ✅ Free SSL/HTTPS
⚠️ Spins down after 15min inactivity (first request slower)
Alternative - Railway.app Free Tier:
- ✅ $5 credit/month
- ✅ Always on (no sleep)
- ✅ Free SSL/HTTPS
Firebase: Free (Admin SDK included)
- Service account JSON in environment variable (not in code)
-
.gitignoreprevents committing secrets - HTTPS enabled (automatic on Render/Railway)
- Backend URL in app
.env(not hardcoded)
Backend not working?
- Check Render logs: Dashboard → Service → Logs
- Verify environment variables are set
- Test health endpoint:
curl https://YOUR_URL/
No notifications sent?
- Check Firestore has FCM tokens (
tokenType: "fcm") - Verify service account permissions
- Check app console logs
Notifications still manual?
- Verify
.envhas correctEXPO_PUBLIC_BACKEND_URL - Rebuild APK with new URL
- Install fresh APK (uninstall old one first)
- Backend README:
backend/README.md - Deployment Guide:
backend/DEPLOYMENT_GUIDE.md - Automatic Notifications Guide:
AUTOMATIC_NOTIFICATIONS_GUIDE.md
- Firebase service account JSON downloaded
- Backend code pushed to GitHub
- Deployed to Render.com or Railway.app
- Environment variables configured
- Backend URL updated in app
.env - New APK built with backend URL
- APK tested - notifications work! 🎉
🎉 Done! Admin updates now trigger automatic notifications to all users!
Questions? Check the full deployment guide in backend/DEPLOYMENT_GUIDE.md