Cloud Native Three-Tier Expense Tracker

Production-grade three-tier architecture on Google Cloud infrastructure

Google Compute EngineCloud SQLLinux (Ubuntu)VPCCloud Load BalancerGunicornNginx

Overview

A cloud-native three-tier expense tracker application deployed on Google Cloud infrastructure. The architecture spans a frontend served through Nginx, a Flask backend managed by Gunicorn, and a Cloud SQL database — all secured inside a VPC and fronted by a Google Cloud Load Balancer.

Problem Statement

Deploying a scalable, production-ready multi-tier application from scratch on cloud infrastructure requires careful orchestration of compute, networking, security, and data layers — a non-trivial challenge for any cloud engineer.

Key Features

  • Three-tier architecture: presentation, application, and data layers
  • Google Compute Engine VMs for application server hosting
  • Cloud SQL for managed relational database storage
  • Nginx reverse proxy serving the frontend and routing API requests
  • Gunicorn WSGI server running the Flask application
  • Cloud Load Balancer distributing traffic across application instances
  • VPC with custom subnets and firewall rules for network isolation

Architecture

1Tier 1 — Presentation: Static frontend served by Nginx on a Compute Engine VM
2Tier 2 — Application: Flask + Gunicorn application server in a private subnet
3Tier 3 — Data: Cloud SQL instance accessible only from the application subnet
4Cloud Load Balancer fronts the entire stack, handling SSL termination
5VPC firewall rules allow only necessary inter-tier traffic

Challenges & Solutions

Securing inter-tier communication within the VPC while keeping the Cloud SQL instance completely off the public internet.

Configured private IP for Cloud SQL and applied VPC firewall rules to restrict database access to only the application subnet CIDR range.

Configuring Nginx as a reverse proxy to correctly route API requests from the frontend to the Gunicorn-managed Flask backend.

Set up Nginx `location` blocks to proxy /api/* requests to the Gunicorn socket, with proper proxy headers for accurate request forwarding.

What I Learned

  • Designing and deploying multi-tier architectures on Google Cloud from scratch
  • Configuring VPC networking, subnets, and firewall rules for production workloads
  • Setting up Nginx and Gunicorn for robust Flask application serving
  • Using Google Cloud Load Balancer for traffic distribution and SSL termination