Deep DivesInfrastructure
Development
Local development guide for the RawStack Infrastructure component.
Setup
cd infrastructure/aws
npm install
cp .env.dist .envEdit .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.jsonUseful commands
| Command | Description |
|---|---|
npm run cdk diff | Preview changes before deploying |
npm run cdk synth | Synthesise CloudFormation templates |
npm run cdk deploy --all | Deploy all stacks |
npm run cdk deploy core | Deploy Core Stack only |
npm run cdk deploy web | Deploy Web Stack only |
npm run cdk deploy admin-hosting | Deploy Admin Stack only |
npm run cdk destroy --all | Tear down all stacks |
npm run watch | Compile 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.