Real-Time Data and Push Notifications with BaaS
Add live, reactive features and engagement-driving push notifications to your indie app using the real-time and messaging capabilities of Backend-as-a-Service platforms.
Real-Time Data and Push Notifications with BaaS is a free Indie Hacker Mobile Apps lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Indie Hacker Mobile Apps learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Why Real-Time Matters
Modern users expect chats, feeds, and dashboards to update instantly without refreshing. BaaS platforms make real-time achievable for a solo developer.
This lesson covers live data sync and push notifications.
Polling vs Real-Time
Two ways to keep data fresh:
- Polling: ask the server repeatedly (wasteful, laggy)
- Real-time: the server pushes changes as they happen
BaaS platforms like Firebase and Supabase offer real-time out of the box.
Subscriptions and Listeners
Real-time works by subscribing to a collection or query. When data changes, your listener fires with the new value.
function onMessagesChanged(messages) {
console.log('Now have', messages.length, 'messages');
}
onMessagesChanged([{ id: 1 }, { id: 2 }]);Unsubscribing to Avoid Leaks
Every subscription must be cleaned up when a screen unmounts, or you leak memory and waste bandwidth.
Store the unsubscribe function and call it on teardown.
const unsubscribe = () => console.log('listener removed');
// later, on screen close:
unsubscribe();Optimistic Updates
For snappy UX, update the UI immediately and reconcile with the server response. If the server rejects the change, roll back.
This makes real-time apps feel instant even on slow networks.
What Are Push Notifications?
Push notifications reach users even when the app is closed. They drive re-engagement when used respectfully.
BaaS platforms provide messaging services that handle device tokens and delivery.
Device Tokens
Each install gets a unique device token. You store it and target messages to it. Tokens can change, so refresh and update them on login.
function saveToken(userId, token) {
return { userId, token, updatedAt: Date.now() };
}
console.log(saveToken('u1', 'abc123'));Triggering Notifications
Send a push from a cloud function when an event happens — a new message, an order update, a reminder. The BaaS handles delivery to Apple and Google servers.
Keep payloads small and actionable.
Permissions and Respect
Users must grant notification permission. Ask at the right moment, explain the value, and never spam.
- Request after showing value
- Let users control categories
- Honor quiet hours
Respect earns long-term engagement.
Real-Time Cost Awareness
Real-time and push are usually billed by reads, connections, or messages. A runaway listener can spike costs.
Scope subscriptions tightly and monitor usage in your BaaS dashboard.
An Engagement Loop
Combine the pieces:
- Subscribe to live data on relevant screens
- Use optimistic updates for speed
- Store device tokens per user
- Trigger respectful, targeted pushes
- Monitor cost and clean up listeners
This loop keeps users coming back.
Quick Check
Test your real-time and push knowledge.
Recap
You added real-time features:
- Subscriptions push live changes instead of polling
- Always unsubscribe to avoid leaks and cost
- Optimistic updates make apps feel instant
- Store device tokens and trigger pushes from cloud functions
- Request notification permission respectfully
Live data and push keep indie apps engaging.
Frequently asked questions
Is the “Real-Time Data and Push Notifications with BaaS” lesson free?
Yes — the full text of “Real-Time Data and Push Notifications with BaaS” is free to read here on the web, and the Indie Hacker Mobile Apps course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Indie Hacker Mobile Apps course, upgrade to CoddyKit PRO.
What will I learn in “Real-Time Data and Push Notifications with BaaS”?
Add live, reactive features and engagement-driving push notifications to your indie app using the real-time and messaging capabilities of Backend-as-a-Service platforms. You practise Indie Hacker Mobile Apps with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Indie Hacker Mobile Apps?
No prior experience is required. Indie Hacker Mobile Apps on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Real-Time Data and Push Notifications with BaaS” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Indie Hacker Mobile Apps lesson?
Yes. Every Indie Hacker Mobile Apps lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Introduction to BaaS Platforms
- User Authentication & Security
- Cloud Databases & Functions
- Real-Time Data and Push Notifications with BaaS