Prompt
React Native backend with push notifications
Latest observation
Oct 1, 2026
OpenAI APIWeb search: off
If you mean “how do I set up a backend for a React Native app to send push notifications?”, here’s the usual architecture:
High-level setup
React Native app:
- Requests push permission
- Gets a push token from FCM (Android) and/or APNs (iOS)
- Sends that token to your backend
Backend:
- Stores device tokens for each user
- Triggers notifications when needed
- Sends pushes through Firebase Cloud Messaging (FCM) or a provider like OneSignal, Expo Push, etc.
Recommended approach
For most apps:
- React Native app: use
@react-native-firebase/messagingor Expo notifications - Backend: use Firebase Admin SDK to send notifications via FCM
- Database: store user IDs + device tokens
Basic flow
- User logs in on app
- App fetches push token
- App sends token to backend API
- Backend saves token
- Backend sends notification to token(s) when event happens
Example backend stack
- Node.js + Express/NestJS
- PostgreSQL or MongoDB for token storage
- Firebase Admin SDK for sending push notifications
Example Node.js backend sending a push via FCM
import admin from "firebase-admin";
import serviceAccount from "./serviceAccountKey.json" assert { type: "json" };
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
});
async function sendPush(token, title, body) {
const message = {
token,
notification: {
title,
body,
},
};
return admin.messaging().send(message);
}
Example API to save token
app.post("/push-token", async (req, res) => {
const { userId, token } = req.body;
await db.pushTokens.upsert({ userId, token });
res.json({ success: true });
});
Things to watch out for
- Token refresh: device tokens can change, so update them when they do
- Multiple devices per user: store multiple tokens
- Invalid tokens: remove old/expired tokens
- Platform differences: iOS needs APNs setup, Android needs FCM config
- Background notifications: handled differently on iOS/Android
If you’re using Expo
You can use:
expo-notifications- Expo push service for sending notifications from backend
If you want, I can give you:
- a complete Node.js backend example,
- a React Native client setup, or
- an Expo-based solution.