# beast-king-0617/gcp-3tier-app architecture

> Architecture diagram of the GitHub repository beast-king-0617/gcp-3tier-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/beast-king-0617/gcp-3tier-app
- Repository: https://github.com/beast-king-0617/gcp-3tier-app

## Overview

This repository is a production-oriented GCP platform reference implementation, with a sample user-facing workflow: a browser loads API status and users from the React app, requests pass through the Gateway to the Go API, and the API reads PostgreSQL. Terraform provisions the cloud platform; GitHub Actions and GitOps/Argo CD manage delivery. The repository also documents monitoring and security capabilities, and includes an SCC-to-Opsgenie alert function. Relationships for platform subsystems are based on README claims; unsampled implementations are represented at their existing directory paths.

Main entry points: [`application/backend/cmd/server/main.go`](https://github.com/beast-king-0617/gcp-3tier-app/blob/main/application/backend/cmd/server/main.go) (Go API server), [`terraform/environments`](https://github.com/beast-king-0617/gcp-3tier-app/tree/main/terraform/environments) (Terraform environments), [`gitops/infrastructure/gateway`](https://github.com/beast-king-0617/gcp-3tier-app/tree/main/gitops/infrastructure/gateway) (Gateway API), [`.github/workflows`](https://github.com/beast-king-0617/gcp-3tier-app/tree/main/.github/workflows) (GitHub Actions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_frontend["React frontend<br/>[App.jsx]"]
  node_frontend_entry["Frontend entry<br/>[main.jsx]"]
  node_backend["Go API server<br/>[main.go]"]
  node_config["Runtime config<br/>[config.go]"]
  node_middleware["HTTP middleware<br/>[middleware.go]"]
  node_handlers["API handlers<br/>[handlers.go]"]
  node_db_access["Database access<br/>[db.go]"]
end

subgraph group_platform["Cloud Platform"]
  node_gateway["Gateway API"]
  node_cloud_sql[("Cloud SQL")]
  node_terraform["Terraform environments"]
  node_gke["GKE platform"]
  node_registry["Artifact Registry"]
  node_sql_inventory["SQL inventory script<br/>[sql.py]"]
  node_cloud_apis["Google Cloud APIs"]
end

subgraph group_delivery["Delivery Operations"]
  node_github["GitHub Actions<br/>[workflows]"]
  node_gitops["GitOps manifests"]
  node_argocd["Argo CD"]
end

subgraph group_security["Security and Observability"]
  node_monitoring["Monitoring"]
  node_scc["Security Command Center"]
  node_alert_handler["SCC alert handler<br/>[opsgenie.py]"]
  node_opsgenie["Opsgenie"]
end

node_browser(("Browser user"))

node_browser -->|"requests"| node_gateway
node_gateway -->|"routes traffic"| node_frontend
node_gateway -->|"routes traffic"| node_backend
node_frontend_entry -->|"renders"| node_frontend
node_frontend -->|"fetches API"| node_backend
node_backend -->|"loads settings"| node_config
node_backend -->|"connects and migrates"| node_db_access
node_backend -->|"registers routes"| node_handlers
node_backend -->|"wraps requests"| node_middleware
node_handlers -->|"queries users"| node_db_access
node_db_access -->|"reads and writes"| node_cloud_sql
node_github -->|"runs provisioning"| node_terraform
node_github -->|"publishes images"| node_registry
node_github -->|"updates manifests"| node_gitops
node_terraform -->|"provisions"| node_gke
node_terraform -->|"provisions"| node_cloud_sql
node_terraform -->|"provisions"| node_registry
node_gitops -->|"reconciled by"| node_argocd
node_argocd -->|"deploys platform routes"| node_gateway
node_scc -->|"sends findings"| node_alert_handler
node_alert_handler -->|"creates alerts"| node_opsgenie
node_sql_inventory -->|"queries inventory"| node_cloud_apis
node_monitoring -.->|"monitors platform"| node_gke

click node_frontend "https://github.com/beast-king-0617/gcp-3tier-app/blob/main/application/frontend/src/App.jsx"
click node_frontend_entry "https://github.com/beast-king-0617/gcp-3tier-app/blob/main/application/frontend/src/main.jsx"
click node_gateway "https://github.com/beast-king-0617/gcp-3tier-app/tree/main/gitops/infrastructure/gateway"
click node_backend "https://github.com/beast-king-0617/gcp-3tier-app/blob/main/application/backend/cmd/server/main.go"
click node_config "https://github.com/beast-king-0617/gcp-3tier-app/blob/main/application/backend/internal/config/config.go"
click node_middleware "https://github.com/beast-king-0617/gcp-3tier-app/blob/main/application/backend/internal/middleware/middleware.go"
click node_handlers "https://github.com/beast-king-0617/gcp-3tier-app/blob/main/application/backend/internal/handlers/handlers.go"
click node_db_access "https://github.com/beast-king-0617/gcp-3tier-app/blob/main/application/backend/internal/db/db.go"
click node_cloud_sql "https://github.com/beast-king-0617/gcp-3tier-app/tree/main/terraform/modules/cloud-sql"
click node_terraform "https://github.com/beast-king-0617/gcp-3tier-app/tree/main/terraform/environments"
click node_gke "https://github.com/beast-king-0617/gcp-3tier-app/tree/main/terraform/modules/gke"
click node_registry "https://github.com/beast-king-0617/gcp-3tier-app/tree/main/terraform/modules/artifact-registry"
click node_github "https://github.com/beast-king-0617/gcp-3tier-app/tree/main/.github/workflows"
click node_gitops "https://github.com/beast-king-0617/gcp-3tier-app/tree/main/gitops/apps"
click node_argocd "https://github.com/beast-king-0617/gcp-3tier-app/tree/main/gitops/argocd"
click node_monitoring "https://github.com/beast-king-0617/gcp-3tier-app/tree/main/terraform/modules/monitoring"
click node_alert_handler "https://github.com/beast-king-0617/gcp-3tier-app/blob/main/abc/opsgenie.py"
click node_sql_inventory "https://github.com/beast-king-0617/gcp-3tier-app/blob/main/abc/sql.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_frontend,node_frontend_entry,node_backend,node_config,node_middleware,node_handlers,node_db_access,node_browser toneBlue
class node_gateway,node_cloud_sql,node_terraform,node_gke,node_registry,node_sql_inventory,node_cloud_apis toneAmber
class node_github,node_gitops,node_argocd toneMint
class node_monitoring,node_scc,node_alert_handler,node_opsgenie toneRose
```

## Components

### Application

- [React frontend](https://github.com/beast-king-0617/gcp-3tier-app/blob/main/application/frontend/src/App.jsx): `application/frontend/src/App.jsx`
- [Frontend entry](https://github.com/beast-king-0617/gcp-3tier-app/blob/main/application/frontend/src/main.jsx): `application/frontend/src/main.jsx`
- [Go API server](https://github.com/beast-king-0617/gcp-3tier-app/blob/main/application/backend/cmd/server/main.go): `application/backend/cmd/server/main.go`
- [Runtime config](https://github.com/beast-king-0617/gcp-3tier-app/blob/main/application/backend/internal/config/config.go): `application/backend/internal/config/config.go`
- [HTTP middleware](https://github.com/beast-king-0617/gcp-3tier-app/blob/main/application/backend/internal/middleware/middleware.go): `application/backend/internal/middleware/middleware.go`
- [API handlers](https://github.com/beast-king-0617/gcp-3tier-app/blob/main/application/backend/internal/handlers/handlers.go): `application/backend/internal/handlers/handlers.go`
- [Database access](https://github.com/beast-king-0617/gcp-3tier-app/blob/main/application/backend/internal/db/db.go): `application/backend/internal/db/db.go`

### Cloud Platform

- [Gateway API](https://github.com/beast-king-0617/gcp-3tier-app/tree/main/gitops/infrastructure/gateway): `gitops/infrastructure/gateway`
- [Cloud SQL](https://github.com/beast-king-0617/gcp-3tier-app/tree/main/terraform/modules/cloud-sql): `terraform/modules/cloud-sql`
- [Terraform environments](https://github.com/beast-king-0617/gcp-3tier-app/tree/main/terraform/environments): `terraform/environments`
- [GKE platform](https://github.com/beast-king-0617/gcp-3tier-app/tree/main/terraform/modules/gke): `terraform/modules/gke`
- [Artifact Registry](https://github.com/beast-king-0617/gcp-3tier-app/tree/main/terraform/modules/artifact-registry): `terraform/modules/artifact-registry`
- [SQL inventory script](https://github.com/beast-king-0617/gcp-3tier-app/blob/main/abc/sql.py): `abc/sql.py`
- **Google Cloud APIs**

### Delivery Operations

- [GitHub Actions](https://github.com/beast-king-0617/gcp-3tier-app/tree/main/.github/workflows): `.github/workflows`
- [GitOps manifests](https://github.com/beast-king-0617/gcp-3tier-app/tree/main/gitops/apps): `gitops/apps`
- [Argo CD](https://github.com/beast-king-0617/gcp-3tier-app/tree/main/gitops/argocd): `gitops/argocd`

### Security and Observability

- [Monitoring](https://github.com/beast-king-0617/gcp-3tier-app/tree/main/terraform/modules/monitoring): `terraform/modules/monitoring`
- **Security Command Center**
- [SCC alert handler](https://github.com/beast-king-0617/gcp-3tier-app/blob/main/abc/opsgenie.py): `abc/opsgenie.py`
- **Opsgenie**

### Other components

- **Browser user**

## Connections

- Browser user → Gateway API: requests (evidence: `README.md`)
- Gateway API → React frontend: routes traffic (evidence: `README.md`)
- Gateway API → Go API server: routes traffic (evidence: `README.md`)
- Frontend entry → React frontend: renders (evidence: `application/frontend/src/main.jsx`)
- React frontend → Go API server: fetches API (evidence: `application/frontend/src/App.jsx`)
- Go API server → Runtime config: loads settings (evidence: `application/backend/cmd/server/main.go`)
- Go API server → Database access: connects and migrates (evidence: `application/backend/cmd/server/main.go`)
- Go API server → API handlers: registers routes (evidence: `application/backend/cmd/server/main.go`)
- Go API server → HTTP middleware: wraps requests (evidence: `application/backend/cmd/server/main.go`)
- API handlers → Database access: queries users (evidence: `application/backend/internal/handlers/handlers.go`)
- Database access → Cloud SQL: reads and writes (evidence: `README.md`)
- GitHub Actions → Terraform environments: runs provisioning (evidence: `README.md`)
- GitHub Actions → Artifact Registry: publishes images (evidence: `README.md`)
- GitHub Actions → GitOps manifests: updates manifests (evidence: `README.md`)
- Terraform environments → GKE platform: provisions (evidence: `README.md`)
- Terraform environments → Cloud SQL: provisions (evidence: `README.md`)
- Terraform environments → Artifact Registry: provisions (evidence: `README.md`)
- GitOps manifests → Argo CD: reconciled by (evidence: `README.md`)
- Argo CD → Gateway API: deploys platform routes (evidence: `README.md`)
- Security Command Center → SCC alert handler: sends findings (evidence: `abc/opsgenie.py`)
- SCC alert handler → Opsgenie: creates alerts (evidence: `abc/opsgenie.py`)
- SQL inventory script → Google Cloud APIs: queries inventory (evidence: `abc/sql.py`)
- Monitoring → GKE platform: monitors platform
