A full-stack application template built with Angular, NestJS, and Terraform for Google Cloud Platform (GCP). Use this repository as a starting point for projects that need a consistent full-stack architecture with GCP infrastructure provisioned via Terraform.
This template provides:
- Frontend – Angular 21 single-page application served by Nginx, deployed to Cloud Run.
- Backend – NestJS REST API with TypeORM + PostgreSQL, deployed to Cloud Run.
- Infrastructure – Reusable Terraform modules covering Cloud Run, Cloud SQL, Cloud Storage, Pub/Sub, Cloud Tasks, Gotenberg, IAM, and Google OAuth secrets.
- Local development – Docker Compose stack (PostgreSQL with pgvector, backend, frontend, Gotenberg).
.
├── client/ # Angular 21 frontend
│ ├── src/
│ ├── Dockerfile
│ ├── nginx.conf
│ └── FRONTEND_DEPLOYMENT.md # Frontend deployment guide
├── server/ # NestJS backend
│ ├── src/
│ ├── Dockerfile
│ ├── .env.example
│ └── BACKEND_DEPLOYMENT.md # Backend deployment guide
├── terraform/
│ ├── environments/
│ │ ├── dev/ # Dev environment (main.tf, variables.tf, etc.)
│ │ └── prod/ # Prod environment
│ └── modules/
│ ├── api/ # Cloud Run – backend service
│ ├── auth/ # Google OAuth secrets
│ ├── cloudTask/ # Cloud Tasks queues
│ ├── database/ # Cloud SQL (PostgreSQL)
│ ├── frontend/ # Cloud Run – frontend service
│ ├── gotenberg/ # Gotenberg PDF service
│ ├── iam/ # Service accounts & IAM bindings
│ ├── pubsub/ # Pub/Sub topics & subscriptions
│ └── storage/ # Cloud Storage buckets
├── docker-compose.yml # Local development stack
└── README.md
- Node.js >= 20 and pnpm (used as the package manager)
- Docker and Docker Compose
- Terraform >= 1.5
- Google Cloud SDK configured with appropriate credentials
- A GCP project with billing enabled
git clone https://github.com/Floressek/Terraform-template.git
cd Terraform-templatecp server/.env.example server/.env
# Edit server/.env and fill in your valuesNote: Docker Compose reads environment variables from the root
.envfile. If you intend to run the full stack via Docker Compose, copy the file to the project root as well:cp server/.env.example .env.
docker compose up --build| Service | URL |
|---|---|
| Frontend | http://localhost:4200 |
| Backend | http://localhost:3000 |
| Gotenberg | http://localhost:3001 |
| PostgreSQL | localhost:5432 |
Backend:
cd server
pnpm install
pnpm run start:devFrontend:
cd client
pnpm install
pnpm run startThe Terraform code lives in terraform/. Each environment (dev, prod) is a self-contained root module that composes the shared modules.
- GCP project with billing enabled
- A GCS bucket for Terraform remote state (update
backend.tfin the environment folder) - Google OAuth credentials (Client ID and Secret)
cd terraform/environments/dev
# Authenticate
gcloud auth application-default login
# Copy and edit the tfvars file
cp terraform.tfvars.example terraform.tfvars
# Fill in project_id, docker_image, frontend_docker_image, google_client_id, google_client_secret
terraform init
terraform plan
terraform apply| Module | Description |
|---|---|
api |
Cloud Run service for the NestJS backend |
auth |
Google OAuth credentials stored in Secret Manager |
cloudTask |
Cloud Tasks queues (embeddings, file processing) |
database |
Cloud SQL PostgreSQL instance |
frontend |
Cloud Run service for the Angular frontend |
gotenberg |
Gotenberg PDF generation service on Cloud Run |
iam |
Service accounts and IAM bindings |
pubsub |
Pub/Sub topics and subscriptions |
storage |
Cloud Storage buckets |
See server/BACKEND_DEPLOYMENT.md and client/FRONTEND_DEPLOYMENT.md for detailed build and push instructions.
This project is licensed under the terms of the LICENSE file included in this repository.