Introduction
An overview of the RawStack Infrastructure component.
The Infrastructure component is an AWS CDK project written in TypeScript. It lives in infrastructure/aws/ and is the single source of truth for the cloud resources that support the RawStack platform.
The codebase is best understood as a small set of CDK stacks that define shared platform infrastructure, application hosting, networking, certificates, and deployment automation.
Tech specification
The Infrastructure component currently uses:
- TypeScript
- AWS CDK v2
- VPC
- RDS for PostgreSQL
- ElastiCache for Redis
- ECS Fargate
- ECR
- Application Load Balancer
- CloudFront
- S3
- Lambda
- EventBridge
- ACM
- Route 53
- Secrets Manager
Architecture
The infrastructure is split into multiple CDK stacks so different parts of the platform can be deployed and evolved independently while still sharing common AWS resources and conventions.
Stack overview
Core stack
The Core stack provides the shared backend platform:
- VPC with public and private subnets across multiple availability zones
- RDS PostgreSQL as the primary relational database
- ElastiCache Redis for caching and token storage
- ECS Fargate for the API service
- Application Load Balancer for routing traffic to the API
- ECS auto-scaling policies
- Deployment automation triggered from ECR push events
Web stack
The Web stack hosts the public-facing frontend:
- ECS Fargate for the Next.js application
- Application Load Balancer
- CloudFront for caching static assets and routing traffic
Admin stack
The Admin stack hosts the internal dashboard:
- S3 for the static Admin build
- CloudFront for global delivery
- Origin access control so the bucket is only reachable through CloudFront
Custom domains
Each stack supports optional custom domain configuration. When the relevant domain variables are set, CDK provisions ACM certificates and Route 53 records automatically.