“What if you could ship scalable applications without constantly worrying about servers, infrastructure, and backend chaos?”
That was the guiding question behind my talk at DevFest Mt Kenya 2025, where I explored how serverless architecture on Google Cloud Platform (GCP) can simplify backend development while enabling powerful, real-world solutions.
To avoid abstract theory, I built and demonstrated a small but complete project called Anime-san—a serverless application that ties together frontend, Cloud Run, Pub/Sub, Cloud Functions, and an M-Pesa STK Push flow.
Why Serverless Matters (Especially in Africa)
In many African developer ecosystems, teams are small, resources are limited, and products need to scale quickly once they gain traction. Traditional backend setups often introduce challenges like:
Server provisioning and maintenance
Downtime handling
Scaling during traffic spikes
Complex deployments
Serverless platforms like Google Cloud Functions and Cloud Run shift this burden to the cloud provider. Developers can focus on business logic, not infrastructure.
The Demo Project: Anime-san
Anime-san is a lightweight demo app with a simple idea:
Display random anime quotes
Allow users to “tip” the developer via an STK Push (demo flow)
Process requests asynchronously using cloud-native services
Despite its simplicity, it demonstrates a real production-style architecture.
High-Level Architecture
The project is split into three main parts:
- Frontend (React)
Fetches random quotes from a public Anime API
Displays quotes in a clean UI
Sends tip requests to the backend
- Backend API (Cloud Run)
Built with Node.js and Express
Exposes a /tip endpoint
Publishes tip requests to a Pub/Sub topic
Runs fully serverless on Cloud Run
- Cloud Function Subscriber
Listens to the Pub/Sub topic
Processes incoming tip events
Triggers an STK Push flow (demo/sandbox)
This decoupled approach ensures the system is scalable, resilient, and event-driven.
Why Pub/Sub?
Instead of handling everything synchronously, the backend publishes messages to Google Cloud Pub/Sub.
Benefits:
Loose coupling between services
Better error handling and retries
Easier scaling
Cleaner separation of concerns
This pattern is especially useful for payment flows, notifications, and background processing.
M-Pesa Integration (Demo Context)
While the demo uses sandbox credentials, it reflects real-world patterns used in production M-Pesa integrations:
Backend validates and publishes payment intent
Subscriber handles payment logic asynchronously
Frontend gets immediate feedback without blocking
This architecture works well for:
Fintech applications
E-commerce platforms
Donation and tipping systems
Utility and service-payment apps
Lessons from the Demo
Serverless reduces cognitive load
Less time spent managing servers means more time building features.
Event-driven systems scale naturally
Pub/Sub and Cloud Functions make it easy to handle growth.
Local problems deserve global tools
Combining M-Pesa with modern cloud tools unlocks powerful local solutions.
Demos matter
Seeing a system work end-to-end is far more effective than slides alone.
Why This Matters for GDG Communities
The goal of this demo wasn’t just to show GCP features—it was to inspire developers to:
Build confidently with cloud-native tools
Think in events, not monoliths
Design systems that scale from day one
Apply global technology to local challenges
Final Thoughts
Serverless is not magic—but when used correctly, it’s a force multiplier.
Anime-san may be a small demo, but it represents a bigger idea:
African developers can build scalable, production-ready systems using modern cloud platforms—today.
Huge thanks to GDG Mt Kenya and everyone who attended the session.
Here is the repo:
https://github.com/GilbertKamau/Anime-san-Cloud-Functions
Top comments (0)