Context: What is TabNews?
TabNews is a Brazilian tech community platform (similar to Hacker News or dev.to) where developers share articles, news, and discussions about technology. They publish a weekly newsletter featuring the best content from the community.
The Problem: Email Fatigue
I really like TabNews newsletters, they help me stay updated about tech news! The platform sends email digests that bundle together 3-4 articles before sending, which makes sense for reducing inbox clutter.
But I had a problem with that approach: I wanted to know about interesting content right away, but I didn't want to keep opening my email or checking the website constantly. The batched email system meant waiting for enough content to accumulate before getting notified.
I thought: it would be cool if I could get instant notifications on my phone, like other app notifications. See it right away, decide if I want to read it, and open it directly to the content.
And while I was thinking about a solution, email scraping, webhook, RSS, a bot, I noticed that TabNews has a public API and newsletters are posted by a specific user profile (@NewsletterOficial). Perfect! I could monitor this profile through the API and send push notifications to my device.
The Requirements
But for all this to happen, I needed something running somewhere that:
- Periodically checked if a new newsletter came out
- When it did, sent push notification to my phone
- Ran by itself, without me having to manage a server
That's when I entered the world of Cloud Functions and cronjobs.
How Does It Work?
For those who don't know, a Cloud Function is basically code that runs in the cloud without you needing to spin up a server. You write a JavaScript function (or Python, Go, etc.), deploy it, and done. All the infrastructure is managed automatically. And a cronjob is just a scheduled task, like "run this function every day at 6 PM" or "run every hour".
Putting the two together, you can have code running periodically in the cloud, checking things, without fixed server costs. You only pay when the function executes.
I decided to use Firebase because I already had a project running there. Firebase has integrated Cloud Functions and Cloud Scheduler (which is their cronjob service) is pretty simple to configure. And Firebase Cloud Messaging (FCM) is free for push notifications.
The Implementation
I started simple: I made a function that runs every hour, fetches the TabNews API to see the latest posts from @NewsletterOficial, compares with the last saved post, and if it's a new post, sends push to my phone. The "compare with last post" works by checking the ID of the last post through the API GET with the last post ID that I saved in the database. If it's different, it means a new newsletter came out. Then I save the new ID and send the notification.
To save this "last checked ID", I used Firestore (which is Firebase's NoSQL database). I created a very simple document that only stores the postId of the last notified newsletter. Before sending any notification, I update this document with the new ID.
The cronjob was configured to run every hour, from 8 AM to 8 PM. I chose this interval because newsletters don't have a fixed publication time, so I need to check throughout the day. And every hour is enough, no need to hammer the API every minute.
The flow is simple:
- Cloud Scheduler triggers the function every hour
- Function fetches latest posts from the API
- Compares with last saved post ID in Firestore
- If new post detected → saves new ID and sends push notification
- If no new post → does nothing
I tested it for a few days and it worked. Every time @NewsletterOficial published, within at most 1 hour I received the notification on my phone. Much better than email, where they wait to summarize content to send.
Expanding the Solution
If it works for newsletters, it works for other things too. I created additional functions:
- Daily Digest: Runs once a day at 6 PM, fetches the most relevant post using the API's relevance filter, and sends a notification
- Weekly Summary: Monitors a weekly digest user who posts every Saturday, configured to check at specific times to catch it right after publication
Same pattern: fetch API → compare → notify. Simple but effective.
Scaling to Multiple Users
None of this is magic. It's just simple polling: fetch API → compare ID → if changed, notify.
Firebase's free tier handles it easily (few requests per day), and there's no server cost because Cloud Functions only charge when executing.
This started as a personal solution but eventually scaled to multiple users. When someone downloads the app and enables notifications, their device token is saved in Firestore, and they're added to the notification broadcast system.
Deep Linking
Each notification includes metadata (postId, slug, owner, type) for deep linking. When users tap a notification, the app opens directly to the correct content. The payload structure makes routing straightforward on the iOS side.
The Stack
Here's what I used:
- Firebase Cloud Functions (Node.js)
- Cloud Scheduler for cronjobs
- Firestore for state management
- Firebase Cloud Messaging for push notifications
- Swift/SwiftUI for the iOS client
- Public REST API for content fetching
Why This Approach Works
This stack is perfect for personal projects:
- Zero cost on low volume (Firebase free tier)
- No server management required
- Scales automatically if needed
- Simple to debug and iterate on
The entire system runs autonomously. I haven't touched the Cloud Functions in months, they just work.
Key Takeaways
- Start small: Solve your own problem first
- Use managed services: Focus on logic, not infrastructure
- Polling is fine: Don't overcomplicate with webhooks if you don't need real-time
- Test locally first: Firebase emulator makes development smooth
- Monitor costs: Set up billing alerts even on free tier
If you're building something similar, this serverless approach with cronjobs is a solid pattern for periodic tasks. The same concept applies to many use cases: monitoring APIs, data scraping, scheduled notifications, health checks, etc.
Want to see how the app turned out? Check out the TabNews app here to see these notifications in action and explore other features I built.
PS: The app is currently available only in Brazilian Portuguese.