Projects Taking push notifications off a busy PHP server
Taking push notifications off a busy PHP server
A separate Node.js service for sending and tracking push notifications, so the main server could focus on everything else.

- How long
- 2020
- My role
- Software ArchitectureDevelopment, Q&A, Support
- Kind of project
- IntegrationMedium project
The problem.
The company’s main PHP server was handling everything, including push notifications, and the notification workload was competing with the server’s other, more time-sensitive work.
What I built.
A separate Node.js service dedicated to push notifications, connected to Google’s Firebase Cloud Messaging (FCM). It stores each notification, sends it, and tracks its status through pending, sent, received and read, per user, group or community, so the company can see real delivery statistics rather than just firing notifications and hoping.
What they got.
Push notifications handled by a dedicated service instead of competing for resources on the main server, with a full audit trail of what was sent and what was actually seen.
For your technical person
Stack. Node.js and Express.js service, MongoDB for storage, and Google Firebase Cloud Messaging (FCM) for delivery. It was split out of the company's busy PHP server so notification work stopped competing with it, and so notifications could scale as a separate service. The business logic was mapped in flow charts first, and the database designed and normalised before the server was built.
How a notification was processed. The PHP server sent one payload: the message, plus the users and groups it was for. The service saved each notification as its own document, created any user accounts that didn't exist yet (for authentication and auditing), and made a registry entry for every recipient. It then posted the messages to FCM in bulk, updating the registry as it went.
Delivery tracking. Each registry entry moved through four states: pending (still to send), sent (FCM confirmed the message was in its queue), received (the device got it) and read (the user opened it). Devices reported received and opened back to the service, so a notification that never arrived could be found and sent again. Statistics were reported per user, per group or per community.
Device API. The service worked both ways. A device could fetch its notifications, update a notification's status, get all unread notifications for a group or category, mark a whole group or category as read, and unsubscribe from groups or categories it no longer wanted.
Security. Server-to-server and user-to-server token authentication, every route token-protected, URL and data sanitisation throughout, and an audit trail on every notification.
Timeline. 2 months, 2020.
Related work.
Running into the same problem? Tell me about yours.
+27 87 150 9305Monday to Friday, 09:00 to 20:00 SAST. Or email info@antondevilliers.com.


