Modern Cloud Stack

Scalable Cloud Run Backend & Firebase Frontend

Video Data Collection

The "Evaluate" page requires Backend running Python with Mediapipe to process the user uploaded video and send the annotated video with Lunge analysis results back to the Front-end. In this project, the Backend is deployed as a Google Cloud-Run service. The Front-end is deployed using the Google Firebase platform.

Compute Engine (Serverless)

Google Cloud Run

Cloud Run is a managed platform that takes user's Docker Container and abstracts away the infrastructure. Instead of managing web "servers" in the old way, Cloud Run allows user to manage "services".

Container Image Deployment

Python backend application code is packaged into an Image via a Dockerfile. This image is a self-contained unit that ensures the application runs consistently across different environments. Once uploaded, it is stored in the Artifact Registry, Google Cloud Run uses it as the "blueprint" for running the application.

Cloud Run Service

A Cloud Run service is created from the container image. This service represents a deployed, publicly accessible endpoint that listens for incoming HTTP requests. Each request is handled by an instance of the container, which starts automatically when traffic arrives.

Dynamic Scaling

Cloud Run uses Horizontal Autoscaling.

  • When traffic is low or idle, Cloud Run can scale the service down to zero instances, meaning no compute resources are used.
  • When multiple user requests arrive simultaneously, Cloud Run automatically creates multiple container instances to handle the increased load.
  • As traffic decreases, unnecessary instances are automatically shut down.

This scaling happens transparently, without any manual intervention.

Benefits

Using Google Cloud Run provides several advantages:

  • No server management or capacity planning
  • Fast deployment using Docker containers
  • Automatic scaling based on user demand
  • Pay-only-for-use pricing model

Summary

Google Cloud Run takes a Docker container image, deploys it as a managed service, and automatically scales the number of running instances based on incoming requests. This makes it well-suited for backend APIs, machine-learning inference services, and web applications that require flexibility and scalability without infrastructure complexity.

Official Cloud Run Documentation
Content Delivery (Edge)

Firebase Hosting

Google Firebase is a platform for hosting and delivering web applications, especially front-end user interfaces. In this project, Firebase is used to host the website that users interact with through their web browser.

Front-End Hosting

The project's web pages (HTML, CSS, Images, Videos and JavaScript files) are uploaded to Firebase Hosting. Firebase stores these files and serves them to users through a global content delivery network (CDN).

Firebase Hosting is designed for static front-end content, meaning it serves files without running server-side code. This makes it well-suited for web interfaces that communicate with a separate backend service.

Connecting Firebase to the Cloud Run Backend

The Firebase-hosted website communicates with the backend deployed on Google Cloud Run using HTTP requests.

  • A user interacts with the web page hosted on Firebase (for example, uploading a video or clicking a button).
  • JavaScript running in the browser sends a HTTP request to the Cloud Run service URL.
  • The Cloud Run backend processes the request, performs tasks such as machine-learning inference or video analysis, and returns a response.
  • The Firebase front-end receives the response and updates the user interface accordingly.

Global Content Delivery Network (CDN)

Firebase's CDN is a worldwide network of servers called "edge servers" that caches the website's static content and delivers it from the location closest to the user, drastically reducing load times, improving performance, and providing a more reliable experience for users anywhere globally. It's integrated into Firebase Hosting, automatically clearing old cached content when new updates are deployed.

Benefits

Using Firebase for the front-end provides several advantages:

  • Fast global delivery: Content is served through a CDN for low latency.
  • Simple deployment: Web pages can be deployed with a single command.
  • Scalability: Firebase automatically handles traffic spikes without manual configuration.
  • Security: Built-in HTTPS and optional authentication features.
  • Separation of concerns: Front-end and backend can be developed and updated independently.

Summary

Google Firebase hosts and delivers the front-end web pages, while Google Cloud Run hosts the backend application. Firebase serves the user interface, and Cloud Run processes user requests and performs computation. Together, they form a scalable, efficient, and easy-to-manage web architecture that supports interactive applications without requiring manual server management.

Firebase Hosting Documentation
Identity & Security

Custom Domain Integration

Connecting a custom domain to the Firebase frontend creates the "Identity" of my App. This layer maps a human-readable name to the Firebase CDN.

Linking a Custom Domain to Firebase Hosting

To provide a professional and user-friendly web address, a custom domain LungeLab.com was purchased using Google Cloud Domains and managed through Cloud DNS. This domain was then connected to Firebase Hosting as a custom domain, allowing users to access the project using a personalized URL instead of a default Firebase address.

How Custom Domain Linking Works

The domain's DNS settings are managed in Google Cloud DNS. Firebase Hosting provides specific DNS records that verify ownership of the domain and map it to the Firebase-hosted website. Once these records are added to Cloud DNS:

  • Firebase confirms ownership of the domain.
  • The domain is linked to the Firebase Hosting site.
  • Any user visiting the custom domain is automatically routed to the Firebase front-end.

Integration with the Firebase and Cloud Run Architecture

By linking the custom domain to Firebase Hosting:

  • Users access the project through a single, easy-to-remember web address.
  • The custom domain points directly to the Firebase front-end.
  • The Firebase front-end continues to communicate with the Cloud Run backend.

This setup allows the entire application — domain, frontend, and backend — to operate within the Google Cloud ecosystem, while keeping each component modular and independently managed.

Benefits

Using a custom domain with Firebase Hosting provides several benefits:

  • Professional appearance: A custom domain increases credibility and usability.
  • Security: Firebase automatically enables HTTPS for the custom domain.
  • Scalability: The domain works seamlessly with Firebase’s global CDN.
  • Unified cloud architecture: All services are managed within Google Cloud.

Summary

Linking a custom domain to Firebase Hosting allows users to access the project through a personalized web address while leveraging Firebase's fast and secure hosting infrastructure. Combined with Cloud Run for backend processing, this approach integrates all components — domain management, frontend hosting, and backend services — into a cohesive and scalable Google Cloud–based system.

Google Cloud Domains Documentation