Skip to content

Deploy NestJS + Angular SaaS — Docker, AWS Terraform & CI/CD

Deployment configuration is the most time-consuming part of SaaS setup. You need Docker images, a container orchestrator, a managed database, Redis for caching and queues, SSL certificates, environment variables, CI/CD pipelines, and health checks — and they all need to work together. Most teams spend 1-2 weeks just on infrastructure before writing a single line of business logic.

The Cloudrix SaaS Starter Kit includes everything you need to go from local development to production on AWS. Docker Compose for local dev, multi-stage Dockerfiles for production, Terraform modules for AWS infrastructure (VPC, ECS Fargate, RDS, ElastiCache, ALB), and GitHub Actions for CI/CD. Every configuration file is included, tested, and documented.

Docker Compose

Full local dev environment with PostgreSQL, Redis, and API — one command to start everything. Hot-reload is enabled for both the NestJS API and Angular frontend. The compose file mirrors production topology so there are no environment surprises.

Terraform AWS

Infrastructure as code for ECS Fargate, RDS, ElastiCache, ALB, and CloudFront. All resources are defined in reusable Terraform modules with sensible defaults. Run 'terraform apply' and your entire AWS infrastructure is provisioned in under 10 minutes.

GitHub Actions

CI/CD pipelines for lint, test, build, and deploy. Triggered on push to main branch. The pipeline builds Docker images, pushes to ECR, and triggers an ECS rolling deployment — zero-downtime by default with health check validation.

Production Dockerfiles

Multi-stage builds for minimal image size. Separate Dockerfiles for API and web app. The NestJS API image is under 150MB and the Angular SSR image is under 100MB. Build cache layers are optimized for fast CI builds.

Nginx

Reverse proxy config with SSL termination, gzip compression, and security headers. Static assets are served with aggressive cache headers for performance. API requests are proxied to the NestJS backend with proper timeout and buffer settings.

Environment Management

Typed environment configs for dev, staging, and production. Validated at startup using class-validator so missing or invalid environment variables cause an immediate, descriptive error instead of a runtime crash hours later.

How It Works in Code

The Docker Compose file starts your entire stack locally with a single command. Here's the core services configuration:

# docker-compose.yml — full local dev stack
services:
  api:
    build: ./apps/api
    ports: ['3000:3000']
    depends_on: [postgres, redis]
    environment:
      DATABASE_URL: postgres://user:pass@postgres:5432/saas
      REDIS_URL: redis://redis:6379

  web:
    build: ./apps/web
    ports: ['4200:4200']

  postgres:
    image: postgres:16-alpine
    volumes: [pgdata:/var/lib/postgresql/data]

  redis:
    image: redis:7-alpine

# Terraform — provision ECS + RDS in one command
# terraform apply -var="environment=production"

What's Included

Docker Compose (full stack local dev)
Dockerfile (multi-stage, optimized layers)
Terraform (VPC, ECS, RDS, ElastiCache)
GitHub Actions CI/CD pipeline
Environment configs (dev, staging, prod)
Health checks on all services
SSL/TLS with auto-renewal
Auto-scaling policies
Log aggregation (CloudWatch)
Zero-downtime deployment
Get SaaS Starter Pro — $249

One-time purchase. 14-day money-back guarantee.