2025

Monday, November 10, 2025

DevPost - Cloud Run Hackathon


From Zero to Real-Time: Building a Scalable Server Monitoring Dashboard with Google Cloud Run

In today's fast-paced digital world, knowing what your servers are doing in real-time isn't a luxury—it's a necessity. For the Google Cloud Run Hackathon, we set out to build Server Metrics, a lightweight, open-source, and highly scalable monitoring solution designed to provide instant insights into system performance.


Our goal was to create a tool that was both powerful for developers and simple enough for anyone to set up, all built on the serverless, scalable foundation of Google Cloud.


What It Does: The Core Features

Server Metrics provides a clean, real-time dashboard that visualizes key performance indicators from any registered server.


Real-Time Metrics: A lightweight Python agent collects and securely transmits CPU, RAM, disk usage, and process information every few seconds.

Interactive Dashboard: The frontend, built with React, uses WebSockets to display data instantly without ever needing to refresh the page.

Secure Authentication: Users can sign up with a traditional email and password or use their Google and GitHub accounts for seamless OAuth2 login.

AI-Powered Insights: Leveraging the Gemini API, users can ask natural language questions about their server data, like "What was the peak CPU usage in the last hour?" to get quick answers.

The Architecture: Powered by Google Cloud

Building a real-time, scalable application presents unique challenges, and Google Cloud provided the perfect set of tools to solve them. Cloud Run was the star of the show.

Cloud Run for Frontend & Backend: We embraced a microservices approach by deploying our React dashboard and our FastAPI backend as two separate, containerized services on Cloud Run. This allows us to scale, update, and manage them independently, benefiting from Cloud Run's serverless auto-scaling and simple deployment model.

Cloud SQL for PostgreSQL: Our user data, server information, and historical metrics are all stored securely in a fully managed Cloud SQL instance, giving us the power of a relational database without the operational overhead.

Cloud Build & Artifact Registry: Our entire CI/CD pipeline is automated with Cloud Build. Every git push triggers a build defined in cloudbuild.yaml, which tests, containerizes, and deploys our application to Cloud Run, ensuring consistent and reliable updates.

Secret Manager: All sensitive data—from database passwords to API keys—is stored securely in Google Secret Manager and safely injected into our Cloud Run services at runtime.

Overcoming the Real-Time Challenge with Pub/Sub

Our biggest architectural challenge was scaling WebSockets on a stateless platform like Cloud Run. An in-memory connection manager works for a single server but fails when you have multiple auto-scaled instances.

We solved this by using Google Pub/Sub as a messaging backplane.

When the backend receives a metric from an agent, it doesn't try to find the right user. Instead, it publishes the metric to a Pub/Sub topic.

Every active Cloud Run instance subscribes to this topic.

When a message arrives, each instance checks if it has a relevant WebSocket client connected and forwards the data.

This event-driven pattern completely decouples our services and allows our real-time updates to scale horizontally, no matter how many users or server instances are running.


What's Next?

This hackathon was an incredible journey into building a modern, cloud-native application. We plan to expand Server Metrics by adding a dedicated Alerting Service—another Cloud Run microservice that will listen for specific events on Pub/Sub and send email notifications when a server's CPU or RAM usage crosses a critical threshold.

Check out our project and see the power of Google Cloud Run in action! #cloudrun #hackathon #devposthackathon