Deploying applications

From ancoleman/ai-design-components · View interactive version

Deploying applications is an AI agent skill from the GitHub repository ancoleman/ai-design-components. Deployment patterns from Kubernetes to serverless and edge functions. Use when deploying applications, setting up CI/CD, or managing infrastructure. Covers Kubernetes (Helm, ArgoCD), serverless (Vercel, Lambda), edge (Cloudflare Workers, Deno), IaC (Pulumi, OpenTofu, SST), and GitOps patterns.

How to use this skill

Skill file

Deploying Applications

Production deployment patterns from Kubernetes to serverless and edge functions. Bridges the gap from application assembly to production infrastructure.

Purpose

This skill provides clear guidance for:

When to Use This Skill

Use this skill when:

Deployment Strategy Decision Tree

WORKLOAD TYPE?

├── COMPLEX MICROSERVICES (10+ services)
│   └─ Kubernetes + ArgoCD/Flux (GitOps)
│       ├─ Helm 4.0 for packaging
│       ├─ Service mesh: Linkerd (5-10% overhead) or Istio (25-35%)
│       └─ See references/kubernetes-patterns.md

├── VARIABLE TRAFFIC / COST-SENSITIVE
│   └─ Serverless
│       ├─ Database: Neon/Turso (scale-to-zero)
│       ├─ Compute: Vercel, AWS Lambda, Cloud Functions
│       ├─ Edge: Cloudflare Workers (<5ms cold start)
│       └─ See references/serverless-dbs.md and references/edge-functions.md

├── CONSISTENT LOAD / PREDICTABLE TRAFFIC
│   └─ Containers (ECS, Cloud Run, Fly.io)
│       ├─ ECS Fargate: AWS-native, serverless containers
│       ├─ Cloud Run: GCP, scale-to-zero containers
│       └─ Fly.io: Global edge, multi-region

├── GLOBAL LOW-LATENCY (<50ms)
│   └─ Edge Functions + Edge Database
│       ├─ Cloudflare Workers + D1 (SQLite)
│       ├─ Deno Deploy + Turso (libSQL)
│       └─ See references/edge-functions.md

└── RAPID PROTOTYPING / STARTUP MVP
    └─ Managed Platform as a Service
        ├─ Vercel (Next.js, zero-config)
        ├─ Railway (any framework)
        └─ Render (auto-deploy from Git)

IaC CHOICE?

├─ TypeScript-first → Pulumi (Apache 2.0, multi-cloud)
├─ HCL-based → OpenTofu (CNCF, Terraform-compatible)
└─ Serverless TypeScript → SST v3 (built on Pulumi)

Core Concepts

Infrastructure as Code (IaC)

Define infrastructure using code instead of manual configuration.

Primary: Pulumi (TypeScript)

Alternative: OpenTofu (HCL)

Serverless: SST v3 (TypeScript)

GitOps Deployment

Declarative infrastructure with Git as source of truth.

ArgoCD (Recommended for platform teams):

Flux (Recommended for DevOps automation):

Service Mesh

Optional layer for microservices communication, security, and observability.

When to Use Service Mesh:

When NOT to Use:

Linkerd (Performance-focused):

Istio (Feature-rich):

See references/kubernetes-patterns.md for service mesh patterns.

Quick Start Workflows

Workflow 1: Deploy Next.js to Vercel (Zero-Config)

# Install Vercel CLI
npm i -g vercel

# Link project
vercel link

# Deploy to production
vercel --prod

See examples/nextjs-vercel/ for complete example.

Workflow 2: Deploy to Kubernetes with ArgoCD

  1. Create Helm chart
  2. Push chart to Git repository
  3. Create ArgoCD Application
  4. ArgoCD syncs automatically

See examples/k8s-argocd/ for complete GitOps setup.

Workflow 3: Deploy Serverless with Pulumi

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

// Create Lambda function
const lambda = new aws.lambda.Function("api", {
    runtime: "nodejs20.x",
    handler: "index.handler",
    role: role.arn,
    code: new pulumi.asset.FileArchive("./dist"),
});

export const apiUrl = lambda.invokeArn;

See examples/pulumi-aws/ and references/pulumi-guide.md for patterns.

Workflow 4: Deploy Edge Function to Cloudflare Workers

import { Hono } from 'hono'

const app = new Hono()

app.get('/api/hello', (c) => {
  return c.json({ message: 'Hello from edge!' })
})

export default app

Deploy with Wrangler:

wrangler deploy

See examples/cloudflare-workers-hono/ and references/edge-functions.md.

Integration with assembling-components

After building an application with assembling-components, this skill provides deployment patterns:

Frontend (Next.js/Vite) → Deployment:

  1. Review deployment decision tree
  2. Choose platform: Vercel (Next.js), Cloudflare Pages (static), or custom (Pulumi)
  3. Set up environment variables
  4. Deploy using chosen method

Backend (FastAPI/Axum) → Deployment:

  1. Containerize application (Dockerfile)
  2. Choose platform: ECS Fargate, Cloud Run, or Kubernetes
  3. Set up IaC (Pulumi or OpenTofu)
  4. Deploy with GitOps (ArgoCD/Flux) or CI/CD

See references/pulumi-guide.md for integration examples.

Reference Files

Kubernetes Deployment

Serverless & Edge

Infrastructure as Code

Utility Scripts

Scripts in scripts/ are executed without loading into context (token-free).

Generate Kubernetes Manifests:

python scripts/generate_k8s_manifests.py --app-name my-app --replicas 3

Validate Deployment Configuration:

python scripts/validate_deployment.py --config deployment.yaml

See script files for full usage documentation.

Examples

Complete, runnable examples in examples/:

Each example includes:

Library Recommendations

Infrastructure as Code (2025)

Primary: Pulumi

Alternative: OpenTofu

Serverless: SST v3

Serverless Databases

Neon PostgreSQL:

Turso SQLite:

PlanetScale MySQL:

See references/serverless-dbs.md for comparison and integration.

Edge Functions

Cloudflare Workers:

Deno Deploy:

Hono Framework:

See references/edge-functions.md for patterns.

Best Practices

Security

Cost Optimization

Performance

Reliability

Troubleshooting

Deployment Failures

Kubernetes pod fails to start:

  1. Check pod logs: kubectl logs <pod-name>
  2. Describe pod: kubectl describe pod <pod-name>
  3. Verify resource limits and requests
  4. Check image pull errors (imagePullSecrets)

Serverless cold starts too slow:

  1. Reduce bundle size (tree-shaking, code splitting)
  2. Use provisioned concurrency (AWS Lambda)
  3. Consider edge functions (Cloudflare Workers)
  4. Optimize initialization code

GitOps sync errors (ArgoCD/Flux):

  1. Verify Git repository access
  2. Check manifest validity (kubectl apply --dry-run)
  3. Review sync policies (prune, selfHeal)
  4. Check ArgoCD/Flux logs

Performance Issues

High service mesh overhead:

  1. Consider switching to Linkerd (5-10% vs Istio 25-35%)
  2. Disable unnecessary features
  3. Evaluate if service mesh is needed

Database connection pool exhaustion:

  1. Increase connection pool size
  2. Use serverless databases (Neon scale-to-zero)
  3. Implement connection pooling (PgBouncer)

See references/ files for detailed troubleshooting guides.

Migration Patterns

From Manual to IaC

  1. Inventory existing infrastructure
  2. Start with non-critical environments (dev, staging)
  3. Use Pulumi/OpenTofu to codify infrastructure
  4. Test in staging before production
  5. Gradual migration (one service at a time)

From Terraform to OpenTofu

# Install OpenTofu
brew install opentofu

# Migrate state
terraform state pull > terraform.tfstate.backup
tofu init -migrate-state
tofu plan
tofu apply

See references/opentofu-guide.md for complete migration.

From EC2 to Containers

  1. Containerize application (create Dockerfile)
  2. Test locally (Docker Compose)
  3. Deploy to staging (ECS/Cloud Run/Kubernetes)
  4. Monitor performance and costs
  5. Cutover production traffic (blue-green deployment)

From Containers to Serverless

  1. Identify stateless services
  2. Refactor to serverless-friendly patterns
  3. Use serverless databases (Neon/Turso)
  4. Deploy to Lambda/Cloud Functions
  5. Monitor cold starts and costs

Next Steps

After deploying applications:

Additional Resources

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.