Deep DivesInfrastructure

Development

Local development guide for the RawStack Infrastructure component.

Setup

cd infrastructure/aws
npm install
cp .env.dist .env

Edit .env with your AWS account details and configuration.

Project structure

infrastructure/aws/
├── bin/
│   └── app.ts                     # CDK entry point — instantiates all stacks
├── lib/
│   ├── core-stack.ts              # VPC, RDS, Redis, ECS API service
│   ├── web-stack.ts               # ECS Next.js + CloudFront
│   ├── admin-stack.ts             # S3 + CloudFront
│   └── domain.ts                  # Shared domain/certificate helpers
├── lambda/
│   ├── core-stack/
│   │   └── deployment-trigger.ts  # Auto-deploy on ECR push
│   └── web-stack/
│       └── deployment-trigger.ts
├── cdk.json
├── .env.dist
└── package.json

Useful commands

CommandDescription
npm run cdk diffPreview changes before deploying
npm run cdk synthSynthesise CloudFormation templates
npm run cdk deploy --allDeploy all stacks
npm run cdk deploy coreDeploy Core Stack only
npm run cdk deploy webDeploy Web Stack only
npm run cdk deploy admin-hostingDeploy Admin Stack only
npm run cdk destroy --allTear down all stacks
npm run watchCompile TypeScript in watch mode

CDK bootstrap

If deploying to an account/region for the first time:

cdk bootstrap aws://<ACCOUNT_ID>/<REGION>

This creates the CDK toolkit stack (S3 bucket, IAM roles) needed for deployments.