| name | stacks-deploy |
| description | Use when deploying a Stacks application — the deployment workflow (build → deploy), pre/post deploy hooks, server vs serverless mode selection, first-time deployment setup, deployment troubleshooting, or the buddy deploy command. For cloud infrastructure details (EC2, Lambda, CloudFormation, Route53, IAM), see stacks-cloud. |
| license | MIT |
| compatibility | Bun >= 1.3.0, TypeScript, AWS |
| allowed-tools | Read Edit Write Bash Grep Glob |
Stacks Deployment
The deployment workflow for Stacks applications.
Quick Deploy
buddy deploy
Deployment Prerequisites
- AWS credentials configured:
buddy configure:aws
- APP_KEY generated:
buddy key:generate (must be colon-separated format)
- APP_URL set in
.env
- Team configured in
config/team.ts
Deployment Flow
- Validation — checks APP_KEY format, AWS region, app URL, team config
- Build — compiles application for production
- Infrastructure — generates CloudFormation template via ts-cloud
- Deploy — creates or updates the CloudFormation stack
- Capabilities: CAPABILITY_IAM, CAPABILITY_NAMED_IAM
- OnFailure: ROLLBACK
- Tags: Environment, Project, ManagedBy
Deploy Hooks (cloud/deploy-script.ts)
export default {
beforeDeploy({ environment, region }) {
console.log(`Deploying to ${environment} in ${region}`)
},
afterDeploy({ environment, region, outputs }) {
console.log('Public IP:', outputs.PublicIp)
console.log('DNS:', outputs.DNS)
console.log('Endpoint:', outputs.Endpoint)
}
}
Deployment Modes
Server Mode (default)
- EC2 instances with ALB
- Best for: full-stack apps, WebSocket support, persistent connections
- Config:
config/cloud.ts → mode: 'server'
Serverless Mode
- Lambda + API Gateway + CloudFront
- Best for: API-only, cost optimization, auto-scaling
- Config:
config/cloud.ts → mode: 'serverless'
First Deployment Checklist
buddy configure:aws
buddy key:generate
buddy env:set APP_URL https://myapp.com
buddy env:set APP_ENV production
buddy deploy
CLI Commands
buddy deploy
buddy cloud --diff
buddy cloud --ssh
buddy cloud:remove
buddy cloud:cleanup
Gotchas
- First deployment creates the CloudFormation stack — subsequent deploys update it
- APP_KEY must be colon-separated format (validated during deployment)
- Default region is
us-east-1 (from AWS_DEFAULT_REGION env)
buddy cloud --diff shows changes BEFORE deploying — always review first
- Deploy hooks run in the deployment process, not on the target server
- For infrastructure details (EC2, Lambda, VPC, etc.), see the
stacks-cloud skill