Google cloud solution n tier serverless web app

From vaila-multimodaltoolbox/vaila · View interactive version

Google cloud solution n tier serverless web app is an AI agent skill from the GitHub repository vaila-multimodaltoolbox/vaila. Assists in designing and implementing secure n-tier serverless web applications and microservices on Google Cloud. Use when users need architecture designs, security checklists, Terraform code, or deployment guidance for multi-tier serverless apps, regional data residency / European sovereignty comp

How to use this skill

Skill file

<!-- disableFinding(all) -->

<!-- mdlint off -->

Secure n-tier serverless web application with strict private application tiers

This skill guides agents through the workflow of designing and implementing a

secure serverless web application with as many architectural design layers as

specified by the user. It uses Cloud Run for the serverless layers and Cloud SQL

for PostgreSQL as the data layer. A three-tier web application might be

represented in three architectural layers: a Cloud Run presentation layer, a

Cloud Run application layer, and a Cloud SQL for PostgreSQL database layer.

The architecture enforces strict physical and network isolation across all tiers (T1 to TN):

Redis for caching, reachable exclusively from authorized application tiers.

General guidance to the LLM

1. Direct Resource Map (Zero-Search File Access)

All necessary reference architectures, HCL templates, and checklists are co-located in this skill. Use exact relative paths from this skill folder:

| Asset Path | Purpose & Usage |

| :--- | :--- |

| assets/main.tf | Single Source of Truth for Terraform (HCL). Contains all security boundaries, Cloud Run v2 configs, PSC endpoints, DNS private zones, and firewall rules. |

| assets/output-template.md | Standardized Solution Architecture report markdown structure. |

| references/non-negotiable-architectural-rules.md | Non-negotiable security rules, audit checklist, and product mappings. |

| references/related-guidance.md | Supplemental deep reference (do NOT read for standard design or IaC tasks; read only if specialized edge-case troubleshooting is explicitly required). |

2. Direct Inline Generation (No Subagent Delegation)

3. One-Shot Clean Artifact Writing

4. Technical Completeness Checklist

Workflow

[!TIP]

Optional MCP Server Integration: If your AI coding client supports the Model Context Protocol (MCP), you can connect the Google Developer Knowledge MCP Server (npx -y @google/mcp-developer-knowledge-server) to dynamically query real-time Google Cloud documentation (cloud.google.com/docs) alongside this skill's offline knowledge base (references/related-guidance.md).

The solution design and implementation workflow is divided into the following

phases:

requirements, constraints, dependencies, and current state.

requirements of the workload.


Phase 1: Requirements discovery and analysis

To prevent multi-turn interview fatigue and maintain trajectory determinism across evaluations, adopt an opinionated 80% default golden path unless the user explicitly requests deviations:

  1. Default Golden Path Configuration (80% Baseline):
  1. Disambiguation Protocol (Optional Clarification Questions):

If the user's initial prompt leaves requirements open-ended (and is not fast-forwarding with exact specs), do not present a multi-topic questionnaire. Only ask concise clarifying questions as needed before confirmation:

1. Load Balancer & Residency Topology: Do you require a Global Application Load Balancer with Cloud CDN (default for worldwide users), or a Regional Application Load Balancer without CDN (for strict EU/regional data residency compliance)?

2. Custom Domain vs. Sandbox Testing: Do you have a registered domain name to configure with a Google-managed certificate, or should we configure self-signed testing mode (use_self_signed_cert = true) for immediate sandbox testing over IP?

3. In-Memory Caching Tier: Should we provision an optional Memorystore for Redis caching tier (Private Services Access) alongside Cloud SQL to accelerate read queries?

  1. Verify & Confirm: Present the confirmed 3-tier golden path decomposition to the user and request confirmation before proceeding to Phase 2 (or fast-forward automatically when instructed).

Phase 2: Solution design

  1. Retrieve Architectural Guidance Efficiently:
  1. Map components to Google Cloud products: Map your confirmed decomposition directly to Google Cloud products using these mandatory product mapping specifications:
  1. Create architecture diagram: Create a clean Mermaid format architecture diagram (assets/output-template.md) illustrating the multi-tier request and data flow across entry point, public reverse proxy, private microservice compute tiers, and private database/caching endpoints.
  1. Draft solution architecture and generate Terraform & gcloud CLI code:

Compile the requirements, technical decomposition, product mapping,

architecture diagram, design recommendations, AND the complete

Infrastructure as Code (`Terraform based on assets/main.tf alongside a

self-contained sequence of gcloud CLI deployment commands adhering to all

Phase 3 mandatory specifications`) into a single Markdown file structured

strictly per the standardized Google Cloud Solution Architecture output

When saving or outputting the report artifact, append an ISO 8601 UTC timestamp and ensure the filename strictly ends with the .md extension (e.g., workload_name_architecture_report-20260701T212820Z.md). Verify that all 9 security boundaries from assets/main.tf are documented cleanly in your report and all template placeholders are replaced with actual complete code blocks. In your response, provide the executive architecture overview, the 9 key security & network boundaries enforced, the complete deploy-ready Terraform code block ( `terraform ... ` ), and step-by-step deployment instructions with links to the generated artifacts (always inlining the complete Terraform code directly in the response when code is requested, rather than only providing file links).

  1. Request review and iterate: Present the solution architecture (and Terraform code, gcloud script, or validation script if generated) to the user and request feedback. Modify and refine both the architecture and code iteratively as the conversation continues.

Phase 3: Implementation plan

  1. Retrieve relevant building block templates from the assets/ directory.

Important: Use the code in assets/main.tf as the

foundation for your Terraform implementation plan (assets/output-template.md for architecture structure).

  1. Identify deployment prerequisites:

sqladmin.googleapis.com, redis.googleapis.com,

servicenetworking.googleapis.com, secretmanager.googleapis.com,

monitoring.googleapis.com, dns.googleapis.com).

  1. Generate Infrastructure as Code (IaC) (Architectural Specifications):

Retrieve relevant architectural and hierarchy guidance from

references/non-negotiable-architectural-rules.md. Base code strictly on the building blocks in

assets/main.tf (Section 1.5 for Cloud NGFW firewall policies, Section 5.1 for Tier 1, Section 5.2 for Tiers 2..N), ensuring database_version = "POSTGRES_18" is preserved exactly. Ensure firewall policies strictly use Cloud NGFW resources (google_compute_network_firewall_policy, google_compute_network_firewall_policy_association, and google_compute_network_firewall_policy_rule with enable_logging = var.enable_monitoring). NEVER generate legacy google_compute_firewall resources or revert to older database versions like POSTGRES_15.

  1. Write deployment instructions & README.md: Draft comprehensive step-by-step deployment instructions (or a complete README.md artifact), ensuring you include:
  1. Request review: Present the implementation plan to the user for

approval. Iterate as needed.


Phase 4: Solution validation

  1. Define solution verification steps & requirements: During validation planning, mandate these 5 verification steps across any deployed environment:
  1. Generate tailored automated validation script: Rather than relying on a static pre-packaged script, generate a custom automated validation script (e.g., self-contained Python validation script using standard built-in urllib / subprocess libraries, or a cross-platform bash/PowerShell script) customized precisely to the user's deployed domain, SSL certificate name, and exact multi-tier *.run.app URIs.
  1. Provide cross-platform execution guidance: Explain how the user can execute the generated script across their target OS (macOS, Linux, Windows PowerShell, or zero-install Google Cloud Shell (https://shell.cloud.google.com)).
  1. Compile validation report: Document the validation checks, the generated verification script code, execution commands, and expected outcomes in Section 6.4 ("Solution verification guide and custom automated validation script") inside assets/output-template.md.
  1. Conduct validation and finalize: Assist the user in running the generated verification script, inspecting logs, and troubleshooting any DNS or WAF propagation issues. Request final approval.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.