How victornwoke/cloudops-goal-tracker--three-tier-architecture works
Purpose and Entry Points
CloudOps Goal Tracker is a containerized three-tier goal-tracking system with Azure Terraform deployment. Runtime entry points are the Go API at backend/main.go, the Node/Express frontend server at frontend/server.js, and the local stack definition at docker-local-deployment/docker-compose.yml. Production deployment is initiated by deploy.sh, which builds/pushes Docker Hub images and applies Terraform.
Presentation and API Gateway
The frontend is a Node.js/Express process that serves browser assets and proxies same-origin /api/goals requests to the backend. Static UI content is rooted in frontend/public/index.html; server/proxy behavior is in frontend/server.js. This tier is the public application boundary: local Docker exposes port 3000, while Azure places it behind an Application Gateway/WAF.
Go Business Service
backend/main.go implements the REST API and business/data-access layer: goal listing and creation/deletion, plus /health and Prometheus /metrics. It is packaged independently by backend/Dockerfile. The backend accepts frontend-proxied calls and owns database connectivity; it is separately exposed locally on 8080 but designed for private, internal Azure access.
PostgreSQL Data Tier
PostgreSQL persists goal data, with local schema/bootstrap SQL in docker-local-deployment/database/init.sql. The local Compose topology wires backend database configuration and service dependencies in docker-local-deployment/docker-compose.yml. In Azure, the database module provisions PostgreSQL Flexible Server and a read replica; network access is intended to remain private.
Local Container Topology
docker-local-deployment/docker-compose.yml composes frontend, backend, and PostgreSQL for development or demonstration. Service images are built from frontend/Dockerfile and backend/Dockerfile; the database initialization script establishes the data contract. The main request flow is browser → frontend /api/* proxy → Go API → PostgreSQL.
Azure Infrastructure Composition
The Terraform root assembles reusable infrastructure modules in infra/main.tf. Networking establishes VNet/subnet segmentation, NSGs, and Bastion in infra/modules/networking/main.tf; compute creates frontend/backend VM Scale Sets and their public/internal traffic paths in infra/modules/compute/main.tf; database infrastructure is defined by infra/modules/database/main.tf. DNS and secret-management boundaries are provided by infra/modules/dns/main.tf and infra/modules/keyvault/main.tf.
Deployment, Secrets, and Environments
Compute provisioning scripts pull Docker Hub images and configure frontend/backend VM instances: infra/modules/compute/scripts/frontend_provision.sh and infra/modules/compute/scripts/backend_provision.sh. Docker Hub credentials are passed to Terraform and stored through the Key Vault module rather than embedded in images. Environment-specific Terraform roots for dev, test, and prod live under infra/environments/dev/main.tf, infra/environments/test/main.tf, and infra/environments/prod/main.tf; Terraform remote-state configuration is represented by infra/backend.tf.
Main entry points: infra/main.tf Terraform composition · compute/main.tf Application compute · server.js Express frontend · docker-compose.yml Local Compose stack
Components 20
Application Runtime
- Browser
- Express frontend · Serves UI and proxies same-origin API calls.
frontend/server.js - Static UI
frontend/public/index.html - Go API · Provides goals, health, and Prometheus metrics.
backend/main.go - PostgreSQL
Local Containers
- Local Compose stack · Builds and wires frontend, backend, and database locally.
docker-local-deployment/docker-compose.yml - Frontend image
frontend/Dockerfile - Backend image
backend/Dockerfile - Database bootstrap
docker-local-deployment/database/init.sql
Azure Infrastructure
- Terraform composition · Assembles reusable Azure modules.
infra/main.tf - Network boundary · Includes Bastion and segmented application access.
infra/modules/networking/main.tf - Application compute · Creates public frontend and internal backend traffic paths.
infra/modules/compute/main.tf - Application Gateway / WAF
- Azure PostgreSQL · Private production data tier.
infra/modules/database/main.tf - Key Vault · Stores Docker Hub credentials supplied to Terraform.
infra/modules/keyvault/main.tf - DNS
infra/modules/dns/main.tf - VM provisioning · Pulls and configures frontend and backend container images.
infra/modules/compute/scripts/frontend_provision.sh
Deployment & Environments
- Deployment script · Builds and pushes images, then applies Terraform.
deploy.sh - Dev, test, prod roots · Environment-specific infrastructure entry points.
infra/environments/prod/main.tf - Terraform remote state
infra/backend.tf
Connections 25
- Browser → Express frontend: HTTP
- Static UI → Express frontend: served by
- Express frontend → Go API: /api/goals proxy
- Go API → PostgreSQL: reads and writes goals
- Local Compose stack → Frontend image: builds
- Local Compose stack → Backend image: builds
- Local Compose stack → Database bootstrap: initializes database
- Frontend image → Express frontend: local container
- Backend image → Go API: local container
- Database bootstrap → PostgreSQL: schema
- Deployment script → Terraform composition: applies
- Deployment script → Frontend image: builds and pushes
- Deployment script → Backend image: builds and pushes
- Terraform composition → Network boundary: provisions
- Terraform composition → Application compute: provisions
- Terraform composition → Azure PostgreSQL: provisions
- Terraform composition → Key Vault: provisions
- Terraform composition → DNS: provisions
- Application Gateway / WAF → Application compute: routes public traffic
- Application compute → Azure PostgreSQL: private database access
- Network boundary → Application Gateway / WAF: ingress network
- Key Vault → Application compute: image credentials
- VM provisioning → Application compute: configures VM instances
- Dev, test, prod roots → Terraform composition: selects module composition
- Terraform remote state → Terraform composition: stores state